Okay so I am having 2 problems. 1st is that i am getting for following error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in also that it says registration was successful but the information is not being added to the table.
<?php
include 'mysql-connect.php';
$username = $_POST['username'];
$password = $_POST['password'];
$firstname = $_POST['first'];
$lastname = $_POST['last'];
$email = $_POST['email'];
$country = $_POST['country'];
$state = $_POST['state'];
$street = $_POST['street'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$result = mysql_num_rows(mysql_query("SELECT * FROM test WHERE username='$username'"));
if($result == 1)
{
echo "<h1>ERROR!</h1>The username you have chosen already exists!";
}
else
{
mysql_query("INSERT INTO test (username, password, first, last, email, country, state, street, city, zip)
VALUES ('$username', '$password', '$firstname', '$lastname', '$email', '$country', '$state', '$street', '$city', '$zip')");
echo "<p>Congratulations! You have successfully registered!</p>";
}
?>