detestableguy Posted September 16, 2010 Share Posted September 16, 2010 I have a database in which i store articles that contain all type of special characters including slashes, single quotes, double quote etc. Previously it was working fine, but now after the updating the xampp, things are not going as usual. I insert are articles using following code $query = "INSERT INTO `articles` (`source`, `heading`, `description`, `catagory`, `detail`, `date`, `timestamp`) values ('$source', '$heading', '$desc', '$catagory', '$detail', '$date', '$timestamp')"; Error I am getting is Error Running query 1You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's economy and emphasized that international community should provide its complet' at line 2 Can anybody tell me whats wrong with my script? Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/ Share on other sites More sharing options...
merylvingien Posted September 16, 2010 Share Posted September 16, 2010 mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111696 Share on other sites More sharing options...
schilly Posted September 16, 2010 Share Posted September 16, 2010 mysql_real_escape_string +1. You have a quote in your data input somewhere which is throwing off the quoted values for the query. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111697 Share on other sites More sharing options...
detestableguy Posted September 16, 2010 Author Share Posted September 16, 2010 Problems Solved. Thanks guys. But I wasn't getting this error in previous version? Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111700 Share on other sites More sharing options...
schilly Posted September 16, 2010 Share Posted September 16, 2010 Previous PHP version or server? I've ran into one server where it had mysql_real_escape_string turned on by default which really threw my coding style off. Took me a while to figure out that issue. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111703 Share on other sites More sharing options...
PFMaBiSmAd Posted September 16, 2010 Share Posted September 16, 2010 Php previously attempted to escape extrnal data for you thinking that they would - help a few beginners blissfully and unknowingly write better (more secure) code. Unfortunately, what they did didn't work in all cases and didn't help at all for those people who weren't even going to use the data in a database. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111706 Share on other sites More sharing options...
schilly Posted September 16, 2010 Share Posted September 16, 2010 ugh brutal. how does that help newbs? it only wasted my time. another reason i hate godaddy. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111718 Share on other sites More sharing options...
PFMaBiSmAd Posted September 16, 2010 Share Posted September 16, 2010 Nothing that php put into the language, like the magic_quotes, that were intended to be aids, have actually ever saved more in typing time then they have cost in troubleshooting time. When you get right down to it, a programming language should be just that, a programming language. The core language should not do extras that the programmer should be doing himself, when and where he needs them to be done. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111729 Share on other sites More sharing options...
schilly Posted September 16, 2010 Share Posted September 16, 2010 Yea definitely. Then they never learn why it's done in the first place. Quote Link to comment https://forums.phpfreaks.com/topic/213582-article-posting-error/#findComment-1111736 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.