Check against mysql field
Posted: Tue Mar 22, 2005 10:14 pm
Hi,
I am trying to check that a username exists before continung with the script .. With the code below it says invalid username .. when the name does exist in the database ..
Im guesing its because username cant be set as user_name .. it must be username .. ?
The database field title is user_name ..
Thanks
I am trying to check that a username exists before continung with the script .. With the code below it says invalid username .. when the name does exist in the database ..
Code: Select all
$sql_user_name_check = mysql_query("SELECT user_name FROM users WHERE user_name = '$user_name'");
$user_name_check = mysql_num_rows($sql_user_name_check);
if($user_name_check == 0)
{
echo "<b>Error</b>: Username doesn't exist .<p> <a href=\"../index.php?pages=compose\">BACK</a></p>";
return;The database field title is user_name ..
Thanks