Re: How do I return 3 results and print </tr>
- From: "Tony" <someone@xxxxxxxxxxxxx>
- Date: Tue, 31 May 2005 09:21:24 -0700
"Aaron Reimann" <aaron.reimann@xxxxxxxxx> wrote in message
news:1117551335.836152.149610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>I am trying to build a table using results from a database query.
> Right now (code below), the code displays each result in a new <tr>. I
> am wanted to display 3 results in one <tr> </tr>, and then create a new
> <tr> with another 3, etc.
>
> Here is human code:
> print a <tr>
> if only 1, 2 or 3 results have been returned, show the results and
> print a </tr>
> if 4, 5, and or 6 results have been returned, print <tr> and show
> results
> if no more results have been returned, print </tr>
>
> Does that make sense? Can anyone help?
Try something like this:
echo "<tr>";
for ($i = 0; $i < pg_numrows($r); $i++) {
echo "<td>";
// output your info here
echo "</td>";
if ( ( $i + 1 ) % 3 == 0 ) { echo "</tr><tr>"; }
}
echo "</tr>";
.
- References:
- How do I return 3 results and print </tr>
- From: Aaron Reimann
- How do I return 3 results and print </tr>
- Prev by Date: phpldapadmin faile to create courier email account
- Next by Date: input SQL data through text box and get nothing?
- Previous by thread: Re: How do I return 3 results and print </tr>
- Next by thread: phpldapadmin faile to create courier email account
- Index(es):