NogDog;11033499 wrote:you may be able to override it locally via either a local php.ini file or a .htaccess file.
The hosting company is not willing to turn off the the magic quotes, they suggested putting "php_flag magic_quotes_gpc off " into an .htaccess file. I tried it. It didn't work with the example in my earlier post.
My .htaccess file currently says:
-FrontPage-
IndexIgnore .htaccess /.?? ~ # /HEADER /README /_vti
Options -Indexes
php_flag magic_quotes_gpc off
Do I have it set up right? Does it go in the root directory, or should I stick it in every directory (you can tell I am up on my .htaccess knowledge).
Here's another point I am confused about. When this first happened I constructed a test module to isolate the problem. Even though magic quotes was on it did not add in the slash before the apostrophe.
if(!empty ($_POST['testLine']))
{
$query = "UPDATE test SET
testLine='".mysqli_real_escape_string($cxn, $_POST['testLine'])."'
LIMIT 1";
mysqli_query($cxn, $query) or die ("Error in query l215: $query");
}
$query ="SELECT testLine
FROM test";
$result = mysqli_query($cxn, $query) or die ('Error ' . mysqli_error($cxn));
$row = mysqli_fetch_assoc($result);
// Pull value from SQL
echo "Test Value is " . $row['testLine'];
$testLine = $row['testLine'];
// enter a string with an apostrophe and see what happens.
echo "<form method='post'>
Enter test line: <input type='text' name='testLine' value='".htmlentities($testLine, ENT_QUOTES)."'>$testLine
<input type='submit' value='SAVE'>
</form>";
NogDog, thanks for the lead on the 'kludge'. I may end up there, but first want to see if I can get the .htaccess to work.