PHP Error - Login Script

Posted by gamerzfuse on Stack Overflow See other posts from Stack Overflow or by gamerzfuse
Published on 2010-04-14T17:55:37Z Indexed on 2010/04/14 18:03 UTC
Read the original article Hit count: 387

Filed under:
|
|

I am creating a new login script/members directory.

I am creating it from scratch without any frameworks (advice on this matter would also be appreciated).

The situation:

// Look up the username and password in the database
    $query = "SELECT admin_id, username FROM admin WHERE adminname = '$admin_user' AND password = SHA1('$admin_pass')";
    $data = mysqli_query($dbc, $query);

    if (mysqli_num_rows($data) == 1) {

This bit of code keeps giving me an error (the last line in particular):

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home8/craighoo/public_html/employees/security/dir_admin.php  on line 20

When echoing the query I get:

SELECT admin_id, username FROM admin WHERE adminname = 'admin' AND password = SHA1('tera#byte')

Thanks in advance!

© Stack Overflow or respective owner

Related posts about php

Related posts about login