chromonium
asked on
MySQL to PHP retrieve
Is it possible, lets say in a database that holds username/password to search for an existing username?
Also how cuold I identify the different records for analysis?
Many Thanks
adam
Also how cuold I identify the different records for analysis?
Many Thanks
adam
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
typo error please replace $query from $sql..
Thanks
Lk
Thanks
Lk
Why do select all fields ??
Just do like
$query = "select count(username) from TABLENAME where username = '$username' ";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows() > 0 )
print "User found.";
else
print "Not found.";
Also beware that this search on username is CASE INSENSITIVE. That is if you search for 'abc' it would even get ABC, aBC,Abc and so on.
Regards,
JD
Just do like
$query = "select count(username) from TABLENAME where username = '$username' ";
$result = mysql_query($query) or die(mysql_error());
if(mysql_num_rows() > 0 )
print "User found.";
else
print "Not found.";
Also beware that this search on username is CASE INSENSITIVE. That is if you search for 'abc' it would even get ABC, aBC,Abc and so on.
Regards,
JD
ASKER
I am not advanced at MySQL, so could you please explain,
Many Thanks
adam