Hello,

  I'm having trouble with /r/n when I try to write to a file.

Here's my code ;

The array I want to write -

$ch =array(
"$SQL_HOST"=> $SQL_HOST,
"SQL_USER"=> $SQL_USER,
"SQL_PWD"=>$SQL_PWD);


and the code I'm using to write the file

$fp = fopen ("newfig.txt", "w");
if (!($fp))
{
print ("ERROR file not open!");
exit;
}
{
fputs($fp,$ch);
foreach($ch as $key => $val) {
fputs($fp,"$$key  = $val/r/n");
}
fclose ($fp);
};

Here's a sample of the file this produces -

$host  = host/r/n$SQL_USER  = user/r/n$SQL_PWD  = dbpass/r/n

What I want is to have crlf after each var  like this -

$host  = host
$SQL_USER  = user
$SQL_PWD  = dbpass

I must be doing /r/n wrong.

My host is Apache on Sun OS.








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to