Help with writing "$" with fopen


Posted on 16th Feb 2014 07:03 pm by admin

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:

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

Here is the code I am attempting to use:

Code: $dir="../includes2/";
$file="connect.inc";
$handle=fopen($dir.$file,'w');
$data="<?phpn";
fwrite($handle,$data);
$data="$hostName ='" . $loc . "'; ";
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

No comments posted yet

Your Answer:

Login to answer
304 Like 21 Dislike
Previous forums Next forums
Other forums

retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and th

Simple MySQL query...
Hello,
How could I do a mysql query that does this: SELECT * WHERE date/time < 5minutes ag

How do I use a global footer..?
If my index.php has a bole bunch of if functions and exit's in them

MySQL issue
I am taking sentences through a form on page. Then checking some condition and trying to insert them

duplicate record notification
In my database, after insertion of records, I want to know if the record inserted is duplicate or no

How to ask a regex question?
Hi, I thought I'd share some of my insight after seeing too many bad questions that either get ignor

OOP help
okay so i have a class im making it has everything setup i just need to randomize the 2 variables an

"From field" in PHP email form
I used a wizard to create a PHP email form. I was able to customize it with the exception of the Fr

removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0m

classic dynpro : hide area and auto adjust hights
Hi,

I want to develop a similar user interface as is used in standard transaction MIGO.

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash