Forum Moderators: coopster
$duplicate = mysql_query("SELECT * FROM MovieDB where name='$name'");
Where $name is what the person enters into the form. Should this be in quotes? And what do I do with result to see if it returns anything? Thanks for the help.
$duplicate = mysql_query("SELECT * FROM MovieDB where name='$name'");
$affected_rows = mysql_num_rows($duplicate);
if($affected_rows >= 1)
{
// Tell them it is duplicate, show error, or whatever you want here
}
else
}
// Insert into database, or whatever.
}
It might need a bit of tweaking depending on how you are connecting to the database, etc. But the jist of it is there.
Hope it helps.
Oh, and as far as the quotes go, try it with and without. I use the quotes as that is how I was shown to do it. Never tried it without em.
Regards,
IamStang