Page 1 of 1

MYSQL TO HTML TABLE

Posted: Tue May 24, 2005 3:43 pm
by Parody
Ok, here is my problem, I have some infomation in a MYSQL database which I need to display in a HTML table. The only problem is, the amount of data can change, so I can't have a fixed table.

So here is the question:
How do I do it? :lol:

I didn't know where to put this topic so I just plonked it in Miscellaneous :oops:

Posted: Tue May 24, 2005 3:53 pm
by pickle
It's quite easy actually:

Code: Select all

$result = mysql_query($query)

echo &quote;<table>&quote;;
while($row = mysql_fetch_assoc($result))
{
  echo &quote;<tr><td>$rowїcolumn1]</td><td>$rowїcolumn2]</td>........</tr>&quote;;
}
echo &quote;</table>&quote;;

Posted: Tue May 24, 2005 3:58 pm
by Parody
Thanks, I was stuck with the theory more than the actual code, but cool. Thanks :) :) :wink: