Forum Moderators: coopster

Message Too Old, No Replies

Outputting Query Results to a Table

         

andybr22

5:50 pm on May 22, 2005 (gmt 0)

10+ Year Member



How would I take the results of my query and output them to a table on my web page?

jatar_k

5:59 pm on May 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I am not sure if you asking about the whole thing or just the output loop itself. This thread outlines the basics
Basics of extracting data from MySQL using PHP [webmasterworld.com]

as far as how the output works, I usually do this

ouput my open table tag before the loop and then close it after, out put each individual row inside the loop

echo "<table>";
while ($row = mysql_fetch_array($query)) {
echo '<tr><td>',$row[somecol1],'</td><td>',$row[somecol2],'</td></tr>';
}
echo "</table>";

that is a basic example but that's how it works.