Hi,
i have trouble with this code:
$query = "SELECT $IDcode FROM users WHERE IDcode = '$IDcode'";
$num_rows = mysql_num_rows($result)>0;
if ($num_rows) {
print ("Sorry - this IDcode is already in registerd!");
} else {
$query = "INSERT INTO .... ";
$result = mysql_query($query, $connection);
}
I want to check if IDcode is already in database. if so, go back to form.
I keep getting this errors:
Notice: Undefined variable: result in c:\installerade program\easyphp1-8\www\page_3.php on line 56
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in c:\installerade program\easyphp1-8\www\page_3.php on line 56
Notice: Undefined variable: connection in c:\installerade program\easyphp1-8\www\page_3.php on line 61
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:\installerade program\easyphp1-8\www\page_3.php on line 61
Error : Duplicate entry '731216' for key 2
Please help me out.
/Joel