List tables by name
Posted: Tue Jun 07, 2005 2:59 pm
I've written a nice little MySql content management system for my web site that uses each table as a "directory" and inserts info into each table as a "page".
I'd like to be able to list the tables in alphabetical order. They do so quite nicely on my intranet but once I uploaded the site to a remote serve a difference in settings does not cause this to happen.
here is the code that generates links to each "directory".
output looks like
any help is appreceated
N8
I'd like to be able to list the tables in alphabetical order. They do so quite nicely on my intranet but once I uploaded the site to a remote serve a difference in settings does not cause this to happen.
here is the code that generates links to each "directory".
Code: Select all
$tables= mysql_list_tables(DB_NAME);
$tab=0;
$i=0;
while ($i < mysql_num_rows($tables)){
$tbl_name=mysql_tablename($tables,$i);
//lists all tables but 'users'
if ($tbl_name=="users"){echo '';}
else {echo "[<a href=?dir=".$tbl_name." class='dir_nav' tabindex=5".$tab++.">".$tbl_name."</a>]\n";}
$i++;
}Code: Select all
<table border=0 class="e;dir_nav"e; width=100%>
<tr><td valign=top ALIGN=center>
ї<a href=?dir=TableName class='dir_nav' tabindex=50>TableName</a>]...ect</td></tr></table>N8