Ok i am having a problem displaying a table on my website. I created a table using phpmyadmin with 3 columns and 3 rows. I am curious how to accomplish this by storing the data in an array and using for loops to display the table, because my brother showed me a while back how to do it this way, but every example I can find shows a different way. Any help would be much appreciated.
[PHP]
<?php
mysql_connect("localhost", "mysql_user", "mysql_password") or
die("Could not connect: " . mysql_error());
mysql_select_db("mydb");
$result = mysql_query("SELECT field1,field2,field3 FROM mytable");
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
printf("Field1: %s Field2: %s, Field3: %s", $row[0], $row[1], $row[2]);
}
mysql_free_result($result);
?>
[/PHP]