This topic is locked

why am i getting this error?

8/1/2006 7:55:05 PM
PHPRunner General questions
A
amirgulamali author

I am using events to insert values into another table.

Everything works well with all fields expect the email field. I want to insert the email record into another table;
My EMAIL field in both tables are viewed as "Email Hyperlink" - is that the reason? I want to maintain the Hyperlink.
My Event code is
//**** Save new data in another table ****

global $conn,$strTableName;
$strSQLSave = "INSERT INTO _1ee0 (StudentNumber, FirstName, LastName, Email) values (";
$strSQLSave .= $values["StudentNumber"].",";

$strSQLSave .= $values["FirstName"].",";

$strSQLSave .= $values["Lastname"].",";

$strSQLSave .= $values["Email"];
$strSQLSave .= ")";

db_exec($strSQLSave,$conn);
return true;
// return true if you like to proceed with adding new record

// return false in other case**
This code works if i remove the email field - which i cant afford to do..
The error message is:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''aaaa@bbbbb.cc')' at line 1
Any suggestions?

A
amirgulamali author 8/1/2006

I figured out if i exchange the following two lines, it works:

$strSQLSave .= $values["Lastname"].",";

$strSQLSave .= $values["Email"];
and interchange the $values position correspondingly
But I still would like to know what caused the error