Simple Checking for empty or set:
PHP Code:
<?php
if (!$apple)
{
echo "there is no apple";
}
else {
echo "there is an apple";
if ($pear)
{
echo "there is an pear";
}
else {
echo "there is no pear";
}
?>
Things wrong with your script:
Random User ID's
Your bound to hit a duplicate
Using a ascending user id would be better
SQL Querys
You need to put a ` before and after database, table, and column names
mysql_num_rows is slow, use a better method like count in the SQL query
POST Data
You are not checking your POST data for HTML or Quotes. Add strip_tags and addslashes to your code.
You are not checking for duplicate emails or checking to see if they are valid.
Error
Don't put the 0 or 1 in quotes for the error variable, that changes the type of the variable to a int, which is for numbers only.
I could go on for days about improvements to your code if you wish.