Re: Walking through a bunch of MySQL Records
| From: | Miles Thompson | Date: | Mon, 14 Nov 2005 21:45:34 +0000 |
| Subject: | Re: Walking through a bunch of MySQL Records | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225784@lists.php.net to get a copy of this message | ||
First of all - remember results display in a web browser, and if you want to print these you will get results that are not like a normal printed page.
Second - here's an approach. Dump all records into an array, you'll have the record count, then selectively fetch elements according to how you want them displayed. Here's a rough approximation.
i = 1
col_lgth = 5
until i = 1+col_lgth+i
tr td
arr[i]
/td td
arr[ i + col_lgth ]
/td /tr
i ++
and keep on looping. You'll have to work out something for odd-numbered result sets, which will not give you a balanced column.
Others may have more sophisticated displays, a CSS guru could probably do something tricky.
I do not think you can access the $result value returned by any of the queries with an index.
HTH - Miles
At 03:03 PM 11/14/2005, Phillip S. Baker wrote:
Greetings all, I have a question. I want to display a group of records pulled form a MySQL db in the following fashion.1 6 2 7 3 8 4 9 5 10Now I can easily figure out how to display the records as1 2 3 4 5 6 7 8 9 10But since I am in an HTML table and the need to display the <TR> and </TR> I am not sure how to make th logic so that I can get the first listing. Can anyone help me out?? Need more information?? Thanks Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php