Hi all,
I need some help i am trying to make a login screen and as faw as I can see my code is ok but it just wont be nice and work
PHP Code:
$unit = mysqli_real_escape_string($dbc,trim($_POST['unitName']));
$pass = mysqli_real_escape_string($dbc,trim($_POST['passWord']));
$test = (SHA1($pass));
//echo "$test";
$query = "SELECT FROM table_trans WHERE unit='$unit' AND Pass='$test'";
echo"$query";
$result = @mysqli_query ($query);
$count = mysqli_num_rows($result);
if($count==1)
{
header("Location: Tic.php" );
}else{
$error = "The unit name or the password was incorrect please try again";
echo "$error";
}
This the problem I get when I try run the code.
//debuging
SELECT FROM table_trans WHERE unit='test' AND Pass='b4dde37aa2aac745c0e6c43447507eaeace3e59f'
//error
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\login.php on line 28
The unit name of password was incorrect please try again
What I dont get is the unit is test and the SHA1=b4dde37aa2aac745c0e6c43447507eaeace3e59f so it should return 1 and let the user in am I missing somthing?
Thanks in advance
|