I have a database that allows text content to be updated. The text content is inserted into a blob field, I have also tried a text data type and a longtext datatype.
The program is an auto responder program that allows the admin to type in a auto responder message into a text area box and the program will automatically send out the auto responder at a certain time in the day.
When I just type in some text into the textarea box including special characters it seems to work. I even typed a bunch of random text into the text area box and it worked, but when I type in the actual email leter that will be sent by the auto responder it comes back with the following error.
Fatal error: MySQL error: 1064 : You have an error in your SQL syntax near 'testing presponder 1', responder_days = '0' where auto_responder_id ' at line 2 in /home/httpd/vhosts/victorville-mls-com.aagthosting.com/httpsdocs/include/error.inc on line 12
Has anyone else had this problem? Help!
Here is the database update. As you can see I have tried to write the update in a couple of different ways. I even tried using a delete to delete the current data from the database and using an insert to update the database.
Here is the code.
$responderID = (int) isSet($_GET['responderID']) ? $_GET['responderID'] : 0;
$responderMessage = $formVars["responderMessage"];
$responderSubject = $formVars["responderSubject"];
$responderDays = $formVars["responderDays"];
if (!(@ mysql_query
("UPDATE tbl_auto_responder SET
`responder_message` = '$responderMessage',
`responder_subject` = '$responderSubject',
`responder_days` = '$responderDays'
where auto_responder_id = '$responderID'", $connection)))
// show errors if any
showerror();
/*if (!(@ mysql_query ("DELETE FROM tbl_auto_responder where auto_responder_id = $responderID", $connection)))
// show errors if any
showerror();
if (!(@ mysql_query ("UPDATE tbl_auto_responder set " .
"responder_message = \"" . $formVars["responderMessage"] . "\", " .
"responder_subject = \"" . $formVars["responderSubject"] . "\", " .
"responder_days = \"" . $formVars["responderDays"] . "\"" .
"where auto_responder_id = $responderID", $connection)))
// show errors if any
showerror();*/
I also tried writing the update statement like this and got the followign error.
This si the code.
if (!(@ mysql_query
("UPDATE tbl_auto_responder SET
`responder_message` = \"$responderMessage\",
`responder_subject` = '$responderSubject',
`responder_days` = '$responderDays'
where `auto_responder_id` = '$responderID'", $connection)))
This is the error.
Fatal error: MySQL error: 1064 : You have an error in your SQL syntax near '"Thanks for your recent visit to my website. Below is the free report you reque' at line 2 in /home/httpd/vhosts/victorville-mls-com.aagthosting.com/httpsdocs/include/error.inc on line 12