...

View Full Version : print table using php



mrjameer
01-02-2007, 05:11 PM
hi,

i want to fetch all records from mysql table and print every record as html table using php.but when i fetch the records,it will displays as one table only.
but i want to display one record as one table.
i dont need to print field names.
please any of your help will be appreciated.

thanks
mrjameer

bubbles19518
01-02-2007, 05:52 PM
Try this:


<?
$sql = "SELECT * FROM table";
$result = mysql_query($sql);
echo("<table>");
while($newarray = mysql_fetch_array($result))
{
echo("<tr>");
echo("<td>");
echo($newarray[0]);
echo("</td>");
echo("</tr>");
}
echo("</table>");
?>


Obviously you'll have to edit the query and while loop to fit your needs.

ClubCosmic
01-02-2007, 07:56 PM
within your while loop, create a table, fill out the rows, and end the table.

ending the while loop first and then closing the table will result in only 1 table.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum