I am running a script the places database content into a include script so that the data can be retreived by others, who have no database access, by simply including the file. When included, the script creates an array containing the data.
I am having difficulty with quotes and single quotes. where they occure, I get a parse error when the include file is is included. I have tried to use the addslashes function to escape these quotes but it will not work. I am running magic_quotes and think that it may be stripping the slashes before they are inserted into the include file.
I wrote a function to to modify the string befor inserting it into the include file. It works wekk for quotes but I am having a problem with the single quote. Any ideas? The function follows.
function slashes($temp)
{
global $temp;
$temp = ereg_replace("'","\'",$temp);
$temp = ereg_replace("\"","@quot;",$temp);
}