I'm currently stuck in a project where I need to pull info from a database and sort it by order of 2 seperate fields and creates a text report of the results. No problems there but now what the boss is wanting to do is break it up into slices of 8 records per file and save each file individually so you get issue3page1.txt is the first 8 results from the query and issue3page2.txt would be result 9-16 of the query. Anything results less than 8 for the final recordset would consitute 1 page as well.
Here's what Im using now. ------------------------------------------------------------------ mysql_connect ($host, $user, $pass); mysql_select_db ($database); $result = mysql_query ("SELECT * FROM listings,agents WHERE listings.agent = agents.name ORDER by area, price DESC"); if ($row = mysql_fetch_array($result)) { do { $agent = $row['agent']; if ($row['banner'] != "No Banner") { fputs($fp, $row['banner']); } fputs($fp, $nl); fputs($fp, $sp); fputs($fp, $sp); fputs($fp, $ar); fputs($fp, $sp); fputs($fp, $row['area']); fputs($fp, $sp); fputs($fp, $dol); fputs($fp, number_format($row['price'], ",")); fputs($fp, $sp); fputs($fp, $sp); fputs($fp, $nl); fputs($fp, $row['copy']); fputs($fp, $nl); $agent_name = $row['name']; fputs($fp, $agent_name); fputs($fp, $nl); $line1 = $row['line1']; $line2 = $row['line2']; $line3 = $row['line3']; $line4 = $row['line4']; fputs($fp, $line1); fputs($fp, $nl); fputs($fp, $line2); fputs($fp, $nl); fputs($fp, $line3); fputs($fp, $nl); fputs($fp, $line4); fputs($fp, $nl); fputs($fp, $nl); } while($row = mysql_fetch_array($result)); } fclose($fp); mysql_close(); echo "Done Creating Sorted Listing Report<br>"; ------------------------------------------------------------------------------ How would I go about creating files of 8 records each in individual files? Thanks, Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php