|  | Posted by Jonathan on 06/17/06 11:38 
Ralph Höglund wrote:> The \n I write out to an open file does not work
 > the second time:
 >
 > $xmlstr = "<?xml version=\"1.0\"\x3F>\n";
 > $songstr = "<songs>\n";
 >
 >   fwrite($handle, "$xmlstr");    //after this I got a new line
 >     fwrite($handle, "$songstr"); //but not after this
 
 I don't know what is the solution to your problem, but you certainly do
 not have to surround variables with quotes to write them to a file. This
 would do:
 
 fwrite($handle, $xmlstr);
 
 If you want to insert a variable in a string then you need quotes:
 
 fwrite($handle, "The contents of this string is $xmlstr");
 
 > $lines = file("./clips/$file_name");
 > foreach ($lines as $line_num => $line) {
 >
 >    fwrite($handle, " <song path=\"$line"); //$line is from another file
 > containing path and song text.
 
 And I guess this line should read
 
 fwrite($handle, " <song path=\"$line\">");
 
 Jonathan
  Navigation: [Reply to this message] |