Posted by J.O. Aho on 10/14/63 11:32
annie wrote:
> Looking to have this do a lookup into the db
> Before it does the insert
> If $email2 AND $site are in the data base stop tell the user he/she is
> already entered.
> If does not exisit then do the insert and send the email.
>
> I have tried but failed
<?PHP
include "common.php";
$email2= $_POST['email'] ;
$site= $_POST['site'] ;
$link = mysql_query($sql,$cn);
$check_sql="SELECT id FROM contest WHERE email='$email2' link='$site'";
$result=mysql_query($check_sql);
if(mysql_num_rows($result,$link)) {
/* There are one or more rows with the same email and site */
echo "Sorry, you already sent it<br>\n";
} else {
/* There are 0 such rows that has both email and site */
echo "Add your code for sending the mail<br>\n";
}
?>
//Aho
Navigation:
[Reply to this message]
|