Page 1 of 1

How do i check if a user already exist i nmy table

Posted: Sun Sep 22, 2002 7:06 am
by pelegk
i have a table with "userid'!
how can i check if the user id exist or not?
thanks i advance
peleg

Posted: Sun Sep 22, 2002 7:12 am
by Coco
i assuming that your talking about a mysql table...
check this out, should help you
http://www.mysql.com/doc/en/Retrieving_data.html

what you would be looking to do would be something like:

Code: Select all

$result = mysql_query("select idnumber from table1 where userid = $user");
if ($row = mysql _fetch_row($result)
    echo "username already used by {$rowї'idnumber']}";
else
{//stuff
}
you get the general idea... hopefully thats enough to get you going and learning... but no too much so as you dont learn at all