
June 21st, 2002, 07:24 PM
|
|
|
|
Join Date: Apr 2007
Location: Bloomington, IN, USA
Posts: 25
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Queston regarding echoing contents of a table in MySQL
I'm not really sure if I have this in the right place. Heh, with all the boards for help I have a feeling there might have been one better suited for this queston that I might have missed. If that's the case, sorry in advance. Also this is probably really simple because I'm a beginner, but nevertheless it has me stumped.
My problem I think is fairly simple, I'm trying to echo a single field in every row of a table into an html table. So basicly, I'd like it to look like this:
<tr>
<td>field1, row1</td>
<td>field1, row2</td>
<td>field1, row3</rd>
</tr>
<tr>
ect..
My queston is how do I get it to put in the <tr>'s and make a new row in the html table every 3 times like that? the way I've always pulled stuff out of a database with with the while loop, but if I had something like..
while ($row = mysql_fetch_array($result) {
ECHO "<td>$row[field1]</td>";
}
Then I just get a straight table down the page of my info. So how do I make it throw <tr>'s into there every 3 records? and still echo everything that's in the table when I don't know how much is there?
|