Hello everyone!
I need to be able to check if a "username" exists in one table in the database, and if not then create a row with that "username" and various other bits and bobs.

I have it so I can input a username into a database but when I try and check another database for any rows with the same username (which is the key) it doesn't pick it up.

The reason I want this to work is because I put a username into a "temporary" database until the person verifys their email and then transfer over. But I need to check if the other database doesn't have that username so I don't duplicate.

This is the code to check the other database so far, which just doesn't pick anything up.

$safe_username = mysql_real_escape_string($_POST[username]);
$query = "SELECT username FROM users WHERE username='$safe_username' ";
$result = mysql_query($query);
$num_rows = mysql_num_rows($result);

if($num_rows > 0) {
  header("Location: http://www.squaredworld.co.uk/index.html"); //return home on fail

If you require any more I would be more then happy to give,
Thanks in advance!