Jump to content

[SOLVED] Double quotes & single quotes


New Coder

Recommended Posts

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

$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);

Thanks to all, it's working now woohoo!! ;D

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.