create table

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
DoppyNL

Post by DoppyNL » Fri Oct 18, 2002 1:15 pm

first build you're query
Load all the data in an array -> all records, not just one record.

Then build some nice loops so that you can build you're table one row at a time. -> you're walking throught you're entire array a couple of times.

Bit of common sence should be able solve this.
Sometimes drawing a smaller table out on paper helps in determining what to do exactly.

Greetz Daan

DoppyNL

Post by DoppyNL » Fri Oct 18, 2002 1:22 pm

Code: Select all

$query=mysql_query("SELECT * FROM `table`"); 

echo "<table width=800 border=0>";
while($data=mysql_fetch_array($query))
{
echo"<tr><td>$data[1]</td><td>$data[2]</Td><td>$data[3]</td></tr>";
}
echo "</table>";

This is a standard method of printing a table from a database in a file.(tnx Pejone) You could adapt it to do it what you want.
I'm here to help out with problems (and learn stuff myself ofcourse), not for writing code.

Greetz Daan

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests