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";

Did you know?Explore Trending and Topic pages for more stories like this.
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

extract a file from zip file
hi,
i know how to unzip a zip file in php, but is there a way to just extract a certain file only

re calling a function without including file
Hi,
i am new to programming in php, i was just checking the wordpress code and found out in the w

Material Issuing for receiving batch
Dear All experts in MM/ PP,

Material issuing from main stores to factory is currently usi

Business Health Check
Hello

I need to create an online business health check for a client it will be multiple choi

Populate drop down list from table??
Lets say for arguments sake that i have a table which contains the numbers 1 to 10.
How can i get

New Search Engine
Hey everyone,

I have a ZIP Code Radius search engine already functional. it displays all of t

PHP IMAGE UPLOAD SCRIPT
Hi for the last week i have been looking for scripts that will upload a photo to a certain folder wh

Open link with largest int string first
I have the following links i would like to open either all at once or one-by-one. How would i procee

do while conditions
i want to display 6 images in a 2x3 table
now what would be the correct logic to
count that th

Setting a default timezone?
I have read about how to change the timezone in PHPMYADMIN, but it changes back, it doesn't STAY the

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