Thanks Robert

> -----Original Message-----
> From: Van Andel, Robert [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 27 November 2002 11:43 AM
> To: Peter Houchin; php_gen
> Subject: RE: [PHP] displaying record number in a cell in a table
>
>
> $result = mysql_query("select * from [database table]");
>
> echo "<table>";
>
> while($data = mysql_fetch_array($result))
> {
>       $count++;
>       echo "<tr>";
>       echo "<td>$count</td>";
>       echo "<td>$data[0]</td>";
>       echo "<td>$data[1]</td>";
>       ...and so on....
>       echo "</tr>";
>
> }
>
> echo "</table>";
>
> This will give you a row number for each row.
>
> Robbert van Andel
>
> -----Original Message-----
> From: Peter Houchin [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 26, 2002 4:49 PM
> To: php_gen
> Subject: [PHP] displaying record number in a cell in a table
>
>
> howdy,
>
> I've had a look around and haven't been able to find what I'm after..
>
> What I'm trying to do is display the number of each individual record with
> in a table in a db WITH OUT relying on the records id, here what I've come
> up with so far:
>
> //get and count the number of records in the table
> $result = mysql_query("SELECT count(*) AS num FROM resellers");
> $num = mysql_result($result,0,"num");
>
> //display the number of records
> for ($i = 1; $i <= $num; $i++) {?>
> <td><div align='center'>
> <font class="content"><?//=$myrow['id']
>
>     print $i;?>
> </font>
> </div></td>
> <?}
>
> now this all works except that it displays 12345etc in every cell of the
> html table when i need it to display as
>
> 1
> 2
> 3
> 4
> 5
> etc
>
> with each number on a new row in the html table ..
>
> TIA & I hope i've made what am after clear enough...
>
> Cheers
>
> Peter
> "the only dumb question is the one that wasn't asked"
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to