I’ve written this basic script below in order to match the password entered to a password from the database. When I run this conditional statement below my browser (safari 4.0.4) displays the “results returned” String, but nothing else.
Can anyone see why nothing is visibly returned?
I have data in the database, and have accessed it before. So the connection is fine, and the data is valid. I am only pulling a single piece of data with my sql statement…this is to match to a single user who is logging in. ( I have a feeling it might be my SQL statement…)
I have viewed the php.net function mysql_fetch_array, but see no fault in my own work. I think I need someone to look at it with fresh eyes.
Any help is appreciated
//already connected to database
$username = isset($_POST['enumber']) ? mysql_real_escape_string($_POST['enumber']) : false;
$q = "SELECT employeePassword FROM members WHERE employeeNumber=".$username;
$result = mysql_query($q);
if(mysql_fetch_array($result) < 1){
echo "no results returned";
}
else{
echo "results returned";
while($row = mysql_fetch_array($result, MYSQL_NUM)){
echo "<b>Database_Password: ";
echo $row[0];
echo "</b>";
}
}