Thursday, 5 September 2013

Using php creating file and adding text to it

Using php creating file and adding text to it

I am trying to create a text file using php and the value is coming
through a db call
$result = mysql_query("SELECT code FROM topic_master");
while ($row = mysql_fetch_array($result)) {
$x1=$row{'code'};
exec("printf $x1 >> code.txt");
}
But the value is not inserted in the code.txt. Only array(code) is
inserted in the code.txt. Actually the $row{'code'} has "#xy { } () %".
How can i write the values to txt file.

No comments:

Post a Comment