i was wondering does anyone know any examples of code which will basically echo all of the tables you have in your database and print them into a drop down menu, so the user can then select the table they want to update.
You can do it the same way you would get data from single table but insted of using SELECT statement you should use: SHOW TABLES Code (markup):
$dbServer = "localhost"; $dbUserName = "root"; $dbPassword = ""; $dbName = "your_db"; $conn = mysql_connect($dbServer, $dbUserName, $dbPassword); // select db information_schema mysql_select_db('information_schema', $conn); $tables = array(); $sql="SELECT table_name FROM `TABLES` T where table_schema='$dbName';"; $res = mysql_query($sql, $conn); $dd = "<select name=\"dbtables\">\n"; while($t = mysql_fetch_assoc($res)) { $dd .= " <option value=\"".$t['table_name']."\">".$t['table_name']."</option>\n"; } $dd .= "</select>"; echo $dd; PHP:
Standard php functions may also be used: mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes regards