what's wrong with these code

[code]
include('login.php');

mysql_select_db("lotusmsiadb", $db_conn);

$txtName = addslashes($txtName);
$txtEmail = addslashes($txtEmail);
$txtAddress = addslashes($txtAddress);
$txtCity = addslashes($txtCity);
$txtEnquiry = addslashes($txtEnquiry);

$search = "SELECT id FROM visitors WHERE email = '$txtEmail'";
$query = mysql_query($search, $db_conn);
if ($query){
if ($row = mysql_fetch_row($query)){
$temp = "INSERT INTO enquiries VALUES( '" . date("Y-m-d H:i:s") . "', '$row[0]', '" . date("Y-m-d", mktime(0, 0, 0, $txtArrMonth, $txtArrDay, $txtArrYear)) . "', '" . date("Y-m-d", mktime(0, 0, 0, $txtDepMonth, $txtDepDay, $txtDepYear)) . "', '$txtAdultQty', '$txtChildQty', '$txtEnquiry')";

$insert_enq = mysql_query($temp);
}
}
else{
$tmp = "INSERT INTO visitors VALUES( NULL, '$txtName', '$txtEmail', '$txtAddress', '$txtCity', '$txtPostcode', '$cboCountry')";

$temp = "INSERT INTO enquiries VALUES( '" . date("Y-m-d H:i:s") . "', LAST_INSERT_ID(), '" . date("Y-m-d", mktime(0, 0, 0, $txtArrMonth, $txtArrDay, $txtArrYear)) . "', '" . date("Y-m-d", mktime(0, 0, 0, $txtDepMonth, $txtDepDay, $txtDepYear)) . "', '$txtAdultQty', '$txtChildQty', '$txtEnquiry')";

$insert_vis = mysql_query($tmp);
$insert_enq = mysql_query($temp);
}

if (!$insert_vis || !$insert_enq){
echo "Your enquiry is not processed!

";
echo "Please try again!
";
echo mysql_errno($db_conn) . ": " . mysql_error($db_conn);
echo "
";
echo "
";
exit;
}

echo "

Your enquiry will be attended shortly!

";
echo "
";
echo "
";

[/code]

Anyone please help me to examine this code. I have been scratching my head for few days.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories