Here is a small code snippet. You first do your query, and then the while statement will fetch each row of data and print it out. The fieldname in this example is called "mystuff" and to print it out from the db, you need to call it $variable["mystuff"] (see the last few lines). And also, I use printf because it works a lot better when u have a variable in the form of:
$variable["fieldname"] (because of the quotes). I hope these tables are dynamic enough for you. 🙂 Good Luck!
$sql = "SELECT * FROM mytable ORDER BY id";
$result = mysql_query($sql, $db);
$num_rows = mysql_num_rows($result);
// If there are no results
if (!$num_rows) { print "Database is Empty!"; }
else {
print "<p><table border=\"0\" cellspacing=\"0\"
cellpadding=\"3\" align=\"center\">\n";
print "<tr bgcolor=\"#759FD0\" align=\"center\"><th
align=\"center\">ID</th>
<th align=\"center\">Mystuff</th></tr>";
while($mystuff_array = mysql_fetch_array($result))
{
print "<form action=\"$PHP_SELF\" method=\"post\">";
print "<tr align=\"right\">\n";
printf("<td align=\"left\"><input type=\"hidden\" name=\"id\"
value=\"%d\">%d</td>
<td align=\"left\"><font color=\"$fontcolor\">%s</font></td>
<td align=\"center\"><input type=\"submit\" value=\">>\"
name=\"view_more\" id=\"$button\"></td></tr>",
$mystuff_array["id"], $mystuff_array["id"],
$mystuff_array["mystuff"]);
print "</form>";
}
// End while
print "</table>\n";
}