RE: [PHP] How can I write in a loop??

From: Date: Fri, 28 Jun 2002 03:34:22 +0000
Subject: RE: [PHP] How can I write in a loop??
Groups: php.general 
Request: Send a blank email to php-general+get-104256@lists.php.net to get a copy of this message
Is this a direct copy of what you've got? If so, line 11 shouldn't be there -----Original Message----- From: sunny AT wde [mailto:sandeep_wde@yahoo.com] Sent: Friday, June 28, 2002 1:24 PM To: php-general@lists.php.net Subject: [PHP] How can I write in a loop?? Hi all, would be very greatful if someone could hlp. Basically I want to extract information from Mysql, and then write it to a file. I can write state pieces of text, but having trouble with writing when the information comes out in a while loop. This is what I hhave so far: -------------------- $result=mysql_query("SELECT topicid FROM $topicdb limit 50"); $file_name = "topics.html"; $file_pointer = fopen($file_name, "w"); while ($r = mysql_fetch_array($result)) { extract($r); $the_text = "$topicid<br>"; fwrite($file_pointer, $the_text); "; } fclose($file_pointer); print "data written to file successfuly"; ---------------------------- but that doesn't seem to work, it only writes the first time, and doesn't add the rest of the loops. anyone help please? sunny

« previous php.general (#104256) next »