bberry91
21 Feb 2012, 05:51 PM
I am having issues with this code. i type in random credentials, and nothing shows up after this code. if i type in a valid username like admin that is in the database, the page works fine. why won't it run properly?
$uname = mysql_real_escape_string($_POST['uname']);
$pword = mysql_real_escape_string($_POST['pword']);
$query = mysql_query("SELECT uname, pword, admin, active FROM members WHERE uname='admin'");
$row = mysql_fetch_array($query) or die(mysql_error());
this code will work. but instead of 'admin', i will put $uname.
$uname = mysql_real_escape_string($_POST['uname']);
$pword = mysql_real_escape_string($_POST['pword']);
$query = mysql_query("SELECT uname, pword, admin, active FROM members WHERE uname='admin'");
$row = mysql_fetch_array($query) or die(mysql_error());
this code will work. but instead of 'admin', i will put $uname.