Might I suggest you count the fields and divide it by the cols you want to display? Example: $forest = mysql_query("SELECT * FROM your_table"); $gump = mysql_num_fields($forest); Because I know my table contains 15 rows I can do this. $tulip = floor($gump /5); I know how many fields to display before row break or create a new table. May seems extremely simple but works very well for me. Thodoris wrote: > Hello everybody, > I have a mysql result set that I want to print out in an html table. > But some times it gets so big that I will probably need to separate it > in to multiple ones. I wrote a function that separates the result set > into three ones like this: > > ... > > But I really need to tell the function in how many tables I need the > result set to be separated. How can I do this? > > What can I put instead of this for 3 tables: (($j == $limit-1) || ($j == > (2*$limit)-1)) > > I can't find the algorithm although I think I have done this before but > I can't remember how. > Why not just use LIMIT in your query and make several? Why do you need to split the data into multiple tables, anyway? > $table = "<table class='inner'>"; > > $table .= "<table><tr><td><table class='inner'>"; That's going to give you badly-formatted HTML. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php