hi, i am trying to update a file every so often with a couple of variables. having some troubles tho.
PHP Code:
$strsql = "select tip_text from tips order by rand() limit 1";
$resulttip=query($strsql);
$tip_text = $resulttip[0][tip_text];
$myFile = "../../includes/siteglobal_cache.php";
$fh = fopen($myFile, 'w') or die("can't open file");
$fileData = '<? ';
$fileData .= ' $site_tip_text = $tip_text; ';
$fileData .= ' ?>';
fwrite($fh, $fileData);
fclose($fh);
what i want the siteglobal_cache.php to be saved is for example:
PHP Code:
<? $site_tip_text = "never eat too many <a href="cookies.php">cookies</a>"; ?>
as you can see there is a problem with all the " and '... i am a bit lost, can someone clarify on how i should edit this code please? cheers
Bookmarks