Jump to content

[SOLVED] check if username is already in database (registration form)


bobocheez

Recommended Posts

Hi,

I have the following code and it will not check to see if a registering user inputs the same data as another user.

 

The snippet:

$query = 'SELECT username FROM users WHERE username = "$username"';
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_BOTH);
if ($row['username'] == $username) {

 

However, it does insert the entry so it is connected to the database.

Thoughts?

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.