Jump to content

user registration script


avillanu

Recommended Posts

I'm in the process of building a user registration script. I would like the script to check the database if the username already exists:

 

$query  = "select * from users where username='$username'";
$result = mysql_query($query);
if ($result->num_rows>0)
{echo 'That username is taken';
   exit;}

 

Unfortunately this does not seem to be working. When I submit a duplicate user, I get a MySQL error rather than getting "That username is taken"

 

My guess is it has to do with:

 

$result->num_rows>0)

 

As my book is based on PHP 5 but PHP 4 is running on my server.

Link to comment
https://forums.phpfreaks.com/topic/63624-user-registration-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.