View Single Post
Old 03-23-2008, 05:36 AM   #4 (permalink)
psychdev
Junior Member
 
Join Date: Mar 2008
Posts: 11
Default Re: I need the PHP code to display in the proper place in a table

I would replace this:

print "<table width=400 border=1>";
while ($get_info = mysql_fetch_row($result)){
print "<tr>";
foreach ($get_info as $field)
print "<td><font face=arial size=1/>$field</font></td>";
print "</tr>";
}
print "</table>";

with:

print "<table width=400 border=1>";
print "<tr>";
print "<td>column1name</td>";
print "<td>column2name</td>";
print "<td>column3name</td>";
print "</tr>";
while($row = @mysql_fetch_array($result))
{
print "<tr>";
print "<td>".$row[column1name]."</td>";
print "<td>".$row[column2name]."</td>";
print "<td>".$row[column3name]."</td>";
print "</tr>";
}
print "</table>";


When you use >>> $get_info as $field <<< all of the data is just plugged onto your site. when you use >>>@mysql_fetch_array<<< you can extract each individual columns value, per row. the loop repeats for as many times are there are rows
psychdev is offline   Reply With Quote
Sponsored Links