MySQL Forums
Forum List  »  PHP

Re: comparing data in a table to user data
Posted by: Rupak Pasari
Date: April 08, 2006 08:56AM

You could perform a check whether the given username already exists in the table. If it does not exists then enter it in the table otherwise give a error message.

Here is the code,

$query = "Select username from table1 where username='$username'";
$result = mysql_query($query);

if(mysql_num_rows($result)>0)
echo "this username exists";

else

/* Insert the record in the table */


Best of luck,
Rupak

Options: ReplyQuote


Subject
Written By
Posted
Re: comparing data in a table to user data
April 08, 2006 08:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.