help displaying sql output in a table
Posted: Wed Feb 04, 2009 11:59 pm
Brand new to php and trying to get a page that will collect data from sql db and output in a table.
should be two columns, the first being date, second being news.... date and news should be the headers, and then all the information would display in one table. I am getting close, but for some reason, every row of data shows in its own individual table, and the titles keep repeating.
Any ideas what im doing wrong?
should be two columns, the first being date, second being news.... date and news should be the headers, and then all the information would display in one table. I am getting close, but for some reason, every row of data shows in its own individual table, and the titles keep repeating.
Any ideas what im doing wrong?
Code: Select all
$result_query = mysql_query($query_ave);
while($row = mysql_fetch_assoc($result_query)){
echo "<table border='1'>";
echo "<tr> <th>Date</th> <th>News</th> </tr>";
echo "<tr><td>";
echo $row['date'];
echo "</td><td>";
echo $row['news'];
echo "</td></tr>";
}
echo "</table>";