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

RSS poster script?
I have found a script that posts RSS's for me on a site that I'm building. However I would like to a

. and .. appearing instead of pictures
First of all, thanks very much for providing this forum. It is very much appreciated!

My son

How to add an image/C++ OpenGL?
Hi,

I have been trying to look online for this and, so far, I haven't found anything usef

Generate PDF
Hi guys,

I would like to know if there is a way to generate pdf when clicking on a link. In f

Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie

Inter Company -- Resources Related Billing (Services Industry)
Hello,

My company has a scenario where:
Company A bills Company C for INTER (cross

ok i need to join all this pages to make 1 neat code
i have 5 pages that make up my tv guide it works 100% but i want to make it 1 page if i can or 2, i

Limiting checkboxes?
Hi guys,

I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec

Motivational Posters
Hello,

I wonder how can i do them in php. Are there any sample codes that you can show me?

I have a parse error in this query help..
Code: $query1="INSERT INTO `rating` (`item_name`, `rating`, `ip_address`, `date_rated`) VALUES

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