I'm very new to php and mysql, but I've been reading everything I can get my hands on. I've got a database now that has multiple tables, a table for each portion of my site.
I'd like to create a page that will sort through the database and create an unordered list containing the name of each table in the database. In each piece of data I am going to have a field called SubMenu that will link to different pages. This way my Table named Services could have an entry with a SubMenu of PC repair. Another entry from the same table could have a SubMenu of Web Design. I want my php to then create another unordered list containing each of the submenus from a particular table. In this example, the submenu for the Services page would be PC Repair and Web Design.
The idea is to have a table dedicated to each portion of my site, and if I want to add another major portion of my site, I can just create a new table in mysql. So the second unordered list of submenus will only show the submenu for the table being used for a particular page...
Does this make sense?
What I'm using now to sort through the submenu is somethink like this:
$result = @mysql_query('SELECT SiteArea FROM wtp');
if (!$result) {
die('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ( $row = mysql_fetch_array($result) ) {
echo('<p>' . $row['SiteArea'] . '</p>');
}
Is there a way to do something similar, like this:
$result = @mysql_query('SHOW tables FROM wtp');
if (!$result) {
die('<p>Error performing query: ' . mysql_error() . '</p>');
}
while ( $row = mysql_fetch_array($result) ) {
echo('<p>' . $row['tables'] . '</p>');
}
I just can't think of what should be in the echo command for the tables, because $row['tables'] doesn't work.
Ideas?😕