Rizla Posted December 9, 2009 Share Posted December 9, 2009 Hi, I wrote a tutorial management system for my site. When i add a normal tutorial with just html, then there's no problem. But when i add a tutorial with php code it goes wrong and i get an error. This error occurs when i submit the form. This is the error: 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 's a spambot and then we can terminate the code so our script stops there. We ' at line 1 I attached 3 files, the tutorial that i insert into the form. The php file where i enter the tutorial into the form. And an export file with info about the mysql table. Has anyone had the same trouble??? And what am i doing wrong? Greetings Rizl4 [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/184529-error-when-saving-tutorial-to-mysql-database/ Share on other sites More sharing options...
JAY6390 Posted December 9, 2009 Share Posted December 9, 2009 I've not checked your code, but have you used mysql_real_escape_string on your values you are inserting? If you do this, it should work Link to comment https://forums.phpfreaks.com/topic/184529-error-when-saving-tutorial-to-mysql-database/#findComment-974144 Share on other sites More sharing options...
Rizla Posted December 9, 2009 Author Share Posted December 9, 2009 no i havent, i'll try this right now and feedback if it helps Link to comment https://forums.phpfreaks.com/topic/184529-error-when-saving-tutorial-to-mysql-database/#findComment-974145 Share on other sites More sharing options...
Rizla Posted December 9, 2009 Author Share Posted December 9, 2009 Thanks jay your tip did the trick problem solved Link to comment https://forums.phpfreaks.com/topic/184529-error-when-saving-tutorial-to-mysql-database/#findComment-974150 Share on other sites More sharing options...
JAY6390 Posted December 9, 2009 Share Posted December 9, 2009 Cool, no problem. You should really be doing that with all your variables used in queries to prevent this sort of thing and SQL injection from occurring. Link to comment https://forums.phpfreaks.com/topic/184529-error-when-saving-tutorial-to-mysql-database/#findComment-974156 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.