MySQL Query Error, thrown in PHP but fine in Terminal. Any Explanations?
Edit: This question is resolved. It was todo with other internal PHP code stripping out comments from the mysql query. The hash '#' in the string was getting treated as a comment starting point and from that point on the rest of the query was removed, thus resulting in a malformed query. But the profiler only traced the query before comments were removed.
I have this MySQL query:
INSERT INTO sacrifice_users
(user_primary_role_id, user_password_salt, user_date_password_updated, user_password, user_login, user_visible_name, user_visible_name_urlsafe, user_firstname, user_lastname, user_email, user_date_created, user_status, user_date_edited)
VALUES
(6,'0(_!f\"}O:r1=Fsvb:Xb|0DG3S/gu&9K}/*5)7[2?30|V7+5<0;!f#)9o;bBc}@*/c\"q-@:8a{)0iY5?}5H7>550]QpS8Y[v(n@2|07)x-|-+-8242w?#4&+@/X:8,8Su','2011-02-02 15:02:18','MVYMGgXFqhM0grGWff9gctr2XPYhGD58IwBQ/aVITNbC9+odsm0eyF+fmyzb4qfes/Ij8hvY9yRVA3PZWzpxbMp8G43DgUhvYOUjqRYeHHfMcYPr7Uihh1hfAKQLS627','Admin','Admin','Admin','Admin','Admin','no-reply@xxx.co.uk','2011-02-02 15:02:18','confirmed','2011-02-02 15:02:18')
and it is throwing an err开发者_如何学Goor from MySQL in PHP
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 ''0(_!f\"}O:r1=Fsvb:Xb|0DG3S/gu&9K}/5)7[2?30|V7+5<0;!f#)9o;bBc}@/c\"q-@:8a{)0iY' at line 4
But running the query by the command line it runs fine. Anybody have any ideas as to why this might be?
I see special characters. Can you try using mysql_real_escape_string to rule this out?
精彩评论