I'm trying to INSERT data into 2 tables with one form submit, but only one table will insert. I've read all the postings on how to do it but I can't get my code to work. The data for the second table, 'quess', inserts okay, but the problem is NO data for the first table, 'users', is inserted. I'm not getting any errors. In the table 'users' an auto-increment number is supposed to be generated for ID which is then used as the ID for the 'quess' table using '$LAST_INSERT_ID'. Here's my code. Any help would be appreciated. Thanks.
<?php
include ('connect.php');
if ($Submit == "Submit")
{$sql = "INSERT INTO users SET
date=current_timestamp(),
firstname='$firstname',
middlename='$middlename',
lastname='$lastname',
company='$company',
email='$email'
";
}
if ($Submit == "Submit")
{$sql = "INSERT INTO quess SET
ID='$LAST_INSERT_ID',
ques1m='$ques1m',
ques1l='$ques1l',
ques2m='$ques2m',
ques2l='$ques2l',
ques3m='$ques3m',
ques3l='$ques3l',
ques4m='$ques4m',
ques4l='$ques4l',
ques5m='$ques5m'
";
if (@($sql)) {
echo "<meta http-equiv='Refresh' content='0; url=thank.php'>";
exit;
}
else {
echo("<p>Error adding data" .
mysql_error() . "</p>");
}
?>