halifaxer Posted August 21, 2007 Share Posted August 21, 2007 Have had a browse around already and can't find any topics related to this, so I'll give it a go here. Let's say I have a table called "customers" which will display many many results. What I want to be able to do is output their names in a structured table when a query is presented. For example: Customer 1, Customer 2, Customer 3, Customer 4 Customer 5, Customer 6, Customer 7, Customer 8 ... where it will always revert to the next row after every 4 results, continuing as such. Can anyone help me? I imagine it's quite a simple code but I'm hopeless Quote Link to comment https://forums.phpfreaks.com/topic/65996-solved-limitingstructuring-query-data-output/ Share on other sites More sharing options...
Wuhtzu Posted August 21, 2007 Share Posted August 21, 2007 There was a topic about this a while ago (maybe 2 months) which covered it pretty extensive... try to look again, maybe it's called something like "dynamic tables" Else have a look here: http://www.phpbuilder.com/columns/patterson20050620_5.php3 or here: http://www.weberdev.com/get_example-3994.html They cover the subject too Quote Link to comment https://forums.phpfreaks.com/topic/65996-solved-limitingstructuring-query-data-output/#findComment-329997 Share on other sites More sharing options...
lemmin Posted August 21, 2007 Share Posted August 21, 2007 Something like this will make a new row in a table every 4 columns. echo "<table><tr>" $i=0; while ($row = mysql_fetch_array($qry)) { if ($i >3) { echo "<tr>"; $i=0; } echo "<td>$row['field']"; $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/65996-solved-limitingstructuring-query-data-output/#findComment-330005 Share on other sites More sharing options...
halifaxer Posted August 21, 2007 Author Share Posted August 21, 2007 OMG! Thank you thank you thank you! You have no idea how little is out there on the net on this subject... or at least with my search terms. lol Quote Link to comment https://forums.phpfreaks.com/topic/65996-solved-limitingstructuring-query-data-output/#findComment-330012 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.