On Sun, 21 Apr 2002, Denis L. Menezes wrote:
> I am looking into 4 books in front of me but somehow cannot find the
> following :
>
> I have a field userid which the user fills in at registration. Before
> entering the data into the database, I want to check if the userid exists in
> the database.
>
> Can someone tell me the name of the function I must use, I will look for the
> rest in the php dictionary.
Say you're using MySQL...
$userid = 'bob';
$sql = "select userid from user where userid='$userid'";
$st = mysql_query($sql);
if (mysql_num_rows($st))
{
print "<p>UserID <b>$userid</b> already in use.</p>";
}
else
{
print '<p>Now adding you to the database...</p>';
// ...
}
miguel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php