PHP Forum

Help with writing "$" with fopen

I just can't get my syntax correct. Could someone help me please? I am trying to write a connect file for inclusion as part of the installation routine for an app I am working on. I need this line to be:

Advertisement
$hostname="whatever the use typed on the previous page";

Here is the code I am attempting to use:

Code: $dir="../includes2/";
Advertisement
$file="connect.inc";
$handle=fopen($dir.$file,'w');
$data="<?phpn";
fwrite($handle,$data);
$data="$hostName ='" . $loc . "'; ";
Advertisement
fwrite($handle,$data);
fclose($handle);
echo "Check and see if it worked."
?>The line in question is :
$data="$hostName ='" . $loc . "'; ";
So far, I have only been successful at getting the following end result:

Code: <?php
='localhost'; What escape characters do I need to use to "$" without php looking for a variable value?

Thanks for the help
Advertisement

0 answers

No answers posted yet. Be the first to answer.

Your answer

Login to answer

Trending today: see what people are reading