Re: I cant get the logic for this...
| From: | Greg Donald | Date: | Mon, 18 Feb 2002 14:13:55 +0000 |
| Subject: | Re: I cant get the logic for this... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-17023@lists.php.net to get a copy of this message | ||
> I want to display return results from my query (which works fine)
> In I tidy way on screen.
>
> So my result returns say seven results, I have a table, and I want to
> show
> 3 results per row of the table... I.e.:
>
> Table
> TR
> TD = result1 /TD TD result2 /TD TD = result3 /TD
> /TD
> /TR
> TR
> TD = result4 /TD TD result5 /TD TD = result6 /TD
> /TD
> /TR
> TR
> TD = result7 /TD TD resultempty /TD TD = resultempty /TD
> /TD
> /TR
> /table
>
> The last two td in row 3 are empty because result found 7 results.
>
> This cant be fixed so echo statements wont work as the result could
> Be 3 or 10 or 56 or whatever.....
>
> As Always your help and or guidance in this matter is appreciated.
You need a incrementer variable so you can tell when you have 3 <td> cells
built, so you know when to end the current <tr> and start a new one.
Then, you need to test that variable again when you run out of
mysql_num_rows(), and fill the 1 or 2 needed <td> cells with
Also, you might wanna look around for some table building classes if your
data is always gonna be really abstract.
------------------------------------------------------------------------
Greg Donald - http://destiney.com/
http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/
------------------------------------------------------------------------