fputs() to save mysql db file

From: Date: Fri, 19 Jan 2001 14:21:07 +0000
Subject: fputs() to save mysql db file
Groups: php.general 
Request: Send a blank email to php-general+get-35625@lists.php.net to get a copy of this message
I am trying to make a tab delimited file of a mysql table so I can open it with Excel. I select the data - 40 fields, 808 records no prob. I view a mysql_num_rows() query to make sure it selects all records; no prob. I create a tab delimited format: $result = mysql_query("SELECT * FROM $database"); $rows=mysql_num_rows($result); while ($row = mysql_fetch_array($result) ) { $field1="$row[field1]"; $field2="$row[field2]"; //etc.... $html.="$field1 $field2 $field3....." } Then I write it to a file: if (! ($myfile=fopen ("tables", "w"))) {echo "file could not be opened";} fputs ($myfile, "$html"); fclose ($myfile); THE PROBLEM IS... The file that is written is missing about 400 records! If I limit the fields to a few, I get all 808 records written no problem. So, I imagine the problem is the file size - the 400 records equate to about 131K. Is there a problem using the fputs() function for larger files? Thanks for helping me. -- Lawrence Blades Digital Technologies P.O. Box 673 Clarksdale, MS 38614 Hm: 662-627-9539 Office: 662-624-6586 Cell: 662-902-3092

« previous php.general (#35625) next »