$strSQL = "SELECT * FROM place ORDER BY placeID";
$result = mysql_query($strSQL);
echo("<table border=\"1\" cellpadding=\"3\">");
echo("<tr><th>ID</th><th>City</th><th>Region</th><th>Country</th><th>Continent</th></tr>");
while ($row = mysql_fetch_array($result)) {
echo("<tr><td>".$row["placeID"]."</td><td>".$row["city"]."</td>");
echo("<td>".$row["region"]."</td><td>".$row["country"]."</td>");
echo("<td>".$row["continent"]."</td></tr>");
}
Is there a way to automate the stuff in the while loop (maybe with a for loop?) so that I don't have to type out each column name, and just put a <td> around each one? I'm just not sure how to reference that....

New Topic/Question
Reply



MultiQuote





|