MadTechie Posted October 16, 2007 Share Posted October 16, 2007 in this case.. try <?php function fix_quotes($str) { $fix_str=stripslashes($str); $quote = array("'","\""); $quote_new = array("''","\\\""); $fix_str = str_replace($quote, $quote_new, $fix_str); return $fix_str; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/73309-solved-double-quotes-single-quotes/page/2/#findComment-370778 Share on other sites More sharing options...
New Coder Posted October 16, 2007 Author Share Posted October 16, 2007 Sorry I changed the sql to update so that it could be edited. I forgot to show change. Sorry with <?php function fix_quotes($str) { $fix_str=stripslashes($str); $quote = array("'","\""); $quote_new = array("''","\\\""); $fix_str = str_replace($quote, $quote_new, $fix_str); return $fix_str; } ?> would I need to replace for my variables because it seems to make no difference Many Thanks to all for help Quote Link to comment https://forums.phpfreaks.com/topic/73309-solved-double-quotes-single-quotes/page/2/#findComment-370801 Share on other sites More sharing options...
mattal999 Posted October 16, 2007 Share Posted October 16, 2007 $issues = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['issues']) : $_POST['issues']; $issues = fix_quotes($issues); $compliments = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['compliments ']) : $_POST['compliments ']; $compliments = fix_quotes($compliments); Quote Link to comment https://forums.phpfreaks.com/topic/73309-solved-double-quotes-single-quotes/page/2/#findComment-370802 Share on other sites More sharing options...
New Coder Posted October 19, 2007 Author Share Posted October 19, 2007 Thanks to all, it's working now woohoo!! I had to change the code a bit:- <?php function fix_quotes($str) { $fix_str=stripslashes($str); $quote = array("\""); $quote_new = array("\"\""); $fix_str = str_replace($quote, $quote_new, $fix_str); return $fix_str; } ?> Now works for me. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/73309-solved-double-quotes-single-quotes/page/2/#findComment-373014 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.