how do you get php to count the number of rows of a result ?? heres a script that displays the result of a search, what can i do to put in a row column that counts the reults ?
<?
print (" <TABLE WIDTH=\"100%\" CELLSPACING=\"0\" CELLPADDING=\"0\" BORDER=\"0\">
<b>Click on the Agency name to view the detailed contact information.</b><br><p>
<tr>
<td HEIGHT=\"21\" NOWRAP width=\"400\" bgcolor=\"#003399\" valign=\"top\">
<FONT COLOR=\"#FFFFFF\"><b>Agency</b></FONT></td>
<td HEIGHT=\"21\" NOWRAP width=\"120\" bgcolor=\"#003399\" valign=\"top\">
<FONT COLOR=\"#FFFFFF\"><b>Phone</b></FONT></td>
<td HEIGHT=\"21\" NOWRAP width=\"175\" bgcolor=\"#003399\" valign=\"top\">
<FONT COLOR=\"#FFFFFF\"><b>E-mail</b></FONT></td>
</tr>\n");
?>
<?php
$db = pg_connect("","","","","funds");
$query = "SELECT * FROM agency ORDER BY agency_name";
$result = pg_exec($db, $query);
$color1 = "#EEEEF8";
$color2 = "#ffffff";
if (!$result) {print ("ERROR"); exit;}
$numrows = pg_numrows($result);
$row=0;
$row_num=0;
do
{
$color = ($row_num%2) ? $color2 : $color1;
$myrow = pg_fetch_row ($result,$row);
print ("<tr><td width=\"400\" bgcolor=".$color." valign=\"top\">
<a href=\"agencyview.php?agency_id=".$myrow[0]."\">$myrow[1]</a></td>
<td width=\"120\" bgcolor=".$color." valign=\"top\">$myrow[7]</td >
<td width=\"175\" bgcolor=".$color." valign=\"top\">$myrow[8]</td ></tr>\n");
$row++;
$row_num++;}
while ($row < $numrows);
print ("</table><br>\n");
pg_close($db);
?>