hey all,
i’m trying to add my “name” and “email” into my database if the email is NOT already in there.
yet my code isn’t working for some reason here it is:
$sql = "SELECT * FROM mytable WHERE email = '$email'";
$result = mysql_query( $sql );
if( mysql_num_rows($result) == 0 ) {
$sql = "INSERT INTO mytable (`name`, `email`) VALUES ('$name', '$email')";
$result = mysql_query( $sql ) or die('Could not add user');
}
?>
Cheers in advance