amount of elements in an array ? - building dynamic html tables for sets of MySQL results

From: Date: Tue, 11 Jul 2000 13:12:51 +0000
Subject: amount of elements in an array ? - building dynamic html tables for sets of MySQL results
Groups: php.general 
Request: Send a blank email to php-general+get-5908@lists.php.net to get a copy of this message
i'm trying to write a script that dynamically generates HTML tables depending on the results from an SQL query. So far, I have managed to set the HTML table headers to be the same as those in the MySQL table. [thanks to rod k -cheers !] Now i'm trying to put the results in the table. Basically, I need a MySQL function to retrieve data and put it into the table until there is no data left.... my problem basically is that I do not have a way of putting the data into the table unless i know how many elements to put in before creating a new <tr>[html table row]. Is there a way of finding out the amount of elements in an array ? Then I could do something like: while($array=mysql_fetch_row ($this->Query_ID)): $i = 0; $j = [amount of elements in $array]; echo "<tr>"; while ($i < $j): echo "<tr><td>$db->Rowdata[$i]</td> <td>"; $i++; endwhile; echo "</tr>"; any ideas ? -nick

« previous php.general (#5908) next »