DarkPrince2005 Posted October 31, 2007 Share Posted October 31, 2007 I have a web form that needs to save to a database but when there is any apostrophe in the field that needs to be saved it doesn't save at all. is it maybe because the insert statement looks like: insert into dis values('$_POST[comment]'); that the single quotations for $_POST is clashing with the apostrophe? Link to comment https://forums.phpfreaks.com/topic/75465-solved-apostrophe/ Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 you can look at the php command addslashes() http://php.net/addslashes Link to comment https://forums.phpfreaks.com/topic/75465-solved-apostrophe/#findComment-381749 Share on other sites More sharing options...
DarkPrince2005 Posted October 31, 2007 Author Share Posted October 31, 2007 ok it seems that it'll work, but how would that look in a mysql statement Link to comment https://forums.phpfreaks.com/topic/75465-solved-apostrophe/#findComment-381752 Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 it will be something like the following fieldname = 'value\'' something like the above Link to comment https://forums.phpfreaks.com/topic/75465-solved-apostrophe/#findComment-381754 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.