Query for Tables
Posted: Fri Sep 10, 2004 7:49 pm
I am wanting to get a dynamic list of TABLES in a Database. Is this possible? How would it look if it is possible?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
SHOW TABLESCode: Select all
<select name="tablesї]" size="6" multiple="multiple" class="forms" id="tablesї]">
<option value="con_news">var_month</option>
<?php
do {
?>
<option value="<?php echo $row_tableLISTї'id']?>"><?php echo $row_tableLISTї'id']?></option>
<?php
} while ($row_tableLIST = mysql_fetch_assoc($tableLIST));
$rows = mysql_num_rows($tableLIST);
if($rows > 0) {
mysql_data_seek($tableLIST, 0);
$row_tableLIST = mysql_fetch_assoc($tableLIST);
}
?>Code: Select all
<?php mysql_select_db($*****, $*******);
$query_tableLIST = "SHOW TABLES";
$tableLIST = mysql_query($query_tableLIST, $*****) or die(mysql_error());
$row_tableLIST = mysql_fetch_assoc($tableLIST);
$totalRows_tableLIST = mysql_num_rows($tableLIST);
?>Code: Select all
<?php
mysql_select_db($databasename, $connect);
$query_queryLIST = "SHOW TABLES";
$queryLIST = mysql_query($query_queryLIST, $connect) or die(mysql_error());
$row_queryLIST = mysql_fetch_row($queryLIST);
$totalRows_queryLIST = mysql_num_rows($queryLIST);
mysql_free_result($queryLIST);
?>Code: Select all
<?php
<?php
do {
?>
<option value="<?php echo $row_queryLIST[0]; ?>"><?php echo $row_queryLIST[0]; ?></option>
<?php
} while ($row_queryLIST = mysql_fetch_row($queryLIST));
$rows = mysql_num_rows($queryLIST);
if($rows > 0) {
mysql_data_seek($queryLIST, 0);
$row_queryLIST = mysql_fetch_row($queryLIST);
}
?>