How do I return 3 results and print </tr>



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?

Thank you


Here is my PG query (function):
###############
function section_get_sections() {
$dbconn = sys_db_connect();
if ($dbconn == FALSE) {
return NULL;
}

$dbquery = <<<EOB
SELECT section.id, section.name
FROM section
ORDER BY section.name

EOB;

$dbresult = sys_db_query ($dbconn, $dbquery);
if ($dbresult == FALSE) {
return NULL;
} else {
return $dbresult;
}
}
###############


Here is my PHP current code displaying the results:
###############
EOB;
$r = section_get_sections();
for ($i = 0; $i < pg_numrows($r); $i++) {
$t = pg_fetch_assoc($r, $i);
print <<<EOB
<tr>
<td class="fe_label" nowrap>
{$t['name']}
</td>
<td class="fe_widget">
<input name="sections[]" type="checkbox" value="{$t['id']}"
EOB;
if (in_array($t['id'], $fd['sections'])) {
echo(" checked");
}
print <<<EOB
>
</td>
</tr>
###############

.



Relevant Pages

  • Excel 2000 Multiple username and password login required for datab
    ... tries to do a database query or refresh in excel 2000? ... Prev by Date: ...
    (microsoft.public.office.developer.vba)
  • Required multiple user name and password logins for database query
    ... How can i force a user name and password requirement when refreshing a ... database query. ... Prev by Date: ...
    (microsoft.public.excel.misc)
  • Re: Fromatting question.
    ... Took some tweaking, but that worked much better so far. ... >> If I want to get the number of characters returned from a database query ... >> and then set the width of a control, what is a good formula or good ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)
  • Fromatting question.
    ... If I want to get the number of characters returned from a database query and ... then set the width of a control, what is a good formula or good practice to ... But of course, the longer the text returned from the query, the wider the ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)