mike12255 Posted December 4, 2013 Share Posted December 4, 2013 Its time for bed but I have to finish this file before I go to bed and I cant figure out the mistake with my query hoping there are some fresh eyes out there that can see it. Here is the line : $query = $qls->Security->make_safe("INSERT INTO `{$qls->config['sql_prefix']}chat` (username, message) VALUES (\"$user\", \"$message\")"); when I die the statement I get: INSERT INTO `qls3_chat` (username, message) VALUES ("mike12255", "TESTING FJFDHSJHDFISEJ") I can take that and query that in through php my admin no problem but when i run a query through php code I get the error: 1064: 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 '"mike12255", "TESTING FJFDHSJHDFISEJ")' at line 1 Link to comment https://forums.phpfreaks.com/topic/284499-pick-apart-my-query-mistake/ Share on other sites More sharing options...
objnoob Posted December 4, 2013 Share Posted December 4, 2013 try single quotes? Link to comment https://forums.phpfreaks.com/topic/284499-pick-apart-my-query-mistake/#findComment-1461167 Share on other sites More sharing options...
mike12255 Posted December 4, 2013 Author Share Posted December 4, 2013 same error Link to comment https://forums.phpfreaks.com/topic/284499-pick-apart-my-query-mistake/#findComment-1461168 Share on other sites More sharing options...
mac_gyver Posted December 4, 2013 Share Posted December 4, 2013 your make_safe method is probably breaking the sql. a) what is the code of you make_safe method? b) you should be escaping the data values being put into the query, not the entire query. Link to comment https://forums.phpfreaks.com/topic/284499-pick-apart-my-query-mistake/#findComment-1461169 Share on other sites More sharing options...
mike12255 Posted December 4, 2013 Author Share Posted December 4, 2013 Thanks for giving me a suggestion of where to look. I marked this as solved I need to get to bed. If in the morning I cannot find a solution ill post more code and unsolve it Link to comment https://forums.phpfreaks.com/topic/284499-pick-apart-my-query-mistake/#findComment-1461171 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.