RE: [PHP-DB] Only Insert on Error?
| From: | Cami | Date: | Wed, 18 Jul 2001 16:41:51 +0000 |
| Subject: | RE: [PHP-DB] Only Insert on Error? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10553@lists.php.net to get a copy of this message | ||
Try using ' instead of \" like:
if ($M_First_Name) {
$sql = "INSERT INTO $table_name
(First_Name, Last_Name, Family_Position, Address, Address1, City, State,
Zip, Email,
Home_Phone, Work_Phone, Coop_Month, Timestamp) VALUES
('$M_First_Name', '$M_Last_Name',
'$MatherFamilyPosition','$M_Address1',
'$M_Address2', '$M_City', '$M_State', '$M_Zip',
'$M_Email', '$M_H_Phone',
'$M_W_Phone', '$coopmonth', 'NOW()')";
if(! $result = mysql_query($sql,$connection)) {
print("ERROR ".mysql_errno().":
".mysql_error()."<br>\n$sql<br>\n");
}
}
------------------------
if ($M_First_Name) {
$sql = "INSERT INTO $table_name
(First_Name, Last_Name, Family_Position, Address, Address1, City, State,
Zip, Email,
Home_Phone, Work_Phone, Coop_Month, Timestamp) VALUES
('$M_First_Name', '$M_Last_Name',
'$MatherFamilyPosition','$M_Address1',
'$M_Address2', '$M_City', '$M_State', '$M_Zip',
'$M_Email', '$M_H_Phone',
'$M_W_Phone', '$coopmonth', 'NOW()')";
// if(! $result = mysql_query($sql,$connection)) {
// print("ERROR ".mysql_errno().":
".mysql_error()."<br>\n$sql<br>\n");
// }
}
Hope it works,
Cami