rogerzebra
Technical User
Hi friends,
I'm trying to validate a form and prevent client submissions being registered twice in the database. But unfortunately something is wrong and I can't see were the problem is. I know it's alot going on here, I was hoping for someone to check my code and perhaps see what's wrong with it. As usual I'm very thankful for your help.
here is the code I'm struggling with, it's the code in bold I have problem with.
My sql code seems to work fine when I execute it separate.
when I execute the code it's just chewing it over and over and nothings happend.
thanks in advance /rz
I'm trying to validate a form and prevent client submissions being registered twice in the database. But unfortunately something is wrong and I can't see were the problem is. I know it's alot going on here, I was hoping for someone to check my code and perhaps see what's wrong with it. As usual I'm very thankful for your help.
here is the code I'm struggling with, it's the code in bold I have problem with.
My sql code seems to work fine when I execute it separate.
Code:
[b]$result = mysql_query("SELECT count(*) FROM submissions WHERE NameInsured = '" . $NameInsured . "'");
if (mysql_result($result) == 0) { [/b]
$query= "INSERT INTO submissions (SubmissionID, NameInsured, Fein, EffectiveDate, DateSubmitted, Producer, Contacts1, ClassCode)
VALUES (NULL, '$NameInsured', '$Fein', '$EffectiveDate', NOW(), '$Producer', '$Contacts1', '$ClassCode')";
$result = mysql_query($query);
$SubmissionID = mysql_insert_id();
$query2= "INSERT INTO test (EvaluationID, DateR) VALUES ('$SubmissionID', '$DateR')";
$result2 = mysql_query($query2);
header ('Location: enter_submissions.php');
[b]}else {
echo "Sorry, your insert data already exist in our database<br /> Please, try again.";
[/b]
}
thanks in advance /rz