Hello, I’m taking an online mysql/PHP course through the big University extension where I live. We’re asked to create an html document that displays database table names (as a header) and to print the data contained in the table. Yep, it is probably the easiest thing… But not for someone who has been using Dreamweaver 4 for the last 4 years!
Here’s my coding (I’ve done my best to only present the important stuff here to save space):
[code]$result = mysql_query(“show tables”, $connection);
while($row = mysql_fetch_array($result, MYSQL_NUM)){
foreach ($row as $attribute)
print "{$attribute} - ";
}
$result = mysql_query(“select * from Athlete, Meet, Event, Results”, $connection);
while($row = mysql_fetch_array($result, MYSQL_NUM)){
foreach ($row as $attribute)[/code]
However, the class instructor asks me to streamline this code: “You don’t want the massive join statement of select * from table, table, table…Instead, do a while loop on the results from “Show tables” and then for each of those tables, do a select * from table. So you’ll have two loops and not a single table name in your code.”
How can you do a SELECT statement and not name the table?
Thanks for reading my first post (probably of many!)
Don