Ralisten
03-03-2005, 08:49 PM
I'm trying to store an object in a MySQL table, but I'm running into an error when I run the INSERT command for MySQL about an error in my MySQL Syntax.
I have tried using 'mysql_escape_string()' and 'addslashes()' to escape anything on the serialized object, but it doesn't seem to help. The error I get is this:
=================================================
MySQL Reported:
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 'blob) VALUES ('s:172:\"a:8:{s:4:\"name\";s:5:\"first\";s:5:\"la
=================================================
The SQL statement that generated the error was:
=================================================
INSERT INTO form_blob (blob) VALUES ('s:172:\"a:8:{s:4:\"name\";s:5:\"first\";s:5:\"label\";s:0:\"\";s:11:\"controltype\";s:7:\"textbox\";s:4:\"size\";s:0:\"\";s:8:\"tabindex\";N;s:8:\"disabled\";b:0;s:5:\"value\";N;s:9:\"maxlength\";s:0:\"\";}\";')
=================================================
Any ideas on getting this to work, or is there a better way to store an array or object in MySQL?
I have tried using 'mysql_escape_string()' and 'addslashes()' to escape anything on the serialized object, but it doesn't seem to help. The error I get is this:
=================================================
MySQL Reported:
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 'blob) VALUES ('s:172:\"a:8:{s:4:\"name\";s:5:\"first\";s:5:\"la
=================================================
The SQL statement that generated the error was:
=================================================
INSERT INTO form_blob (blob) VALUES ('s:172:\"a:8:{s:4:\"name\";s:5:\"first\";s:5:\"label\";s:0:\"\";s:11:\"controltype\";s:7:\"textbox\";s:4:\"size\";s:0:\"\";s:8:\"tabindex\";N;s:8:\"disabled\";b:0;s:5:\"value\";N;s:9:\"maxlength\";s:0:\"\";}\";')
=================================================
Any ideas on getting this to work, or is there a better way to store an array or object in MySQL?
