note 18067 added to function.mysql-tablename
| From: | mmaniscalco18 at yahoo dot com | Date: | Wed, 09 Jan 2002 14:46:55 +0000 |
| Subject: | note 18067 added to function.mysql-tablename | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-24581@lists.php.net to get a copy of this message | ||
This code is for a pull down list of the tables in your Database. Works well with forms.
<?PHP
$DBhost = "localhost";
$DBname = "mysql";
// Connecting, selecting database.
$link = mysql_connect("$DBhost");
mysql_select_db("$DBname");
echo "<select name=\"table\">";
$result = mysql_list_tables($DBname);
for ($i = 0; $i < mysql_num_rows($result); $i++) {
$tbl_names[$i] = mysql_tablename($result, $i)
echo "<option
value=\"".$tbl_names[$i]."\">".$tbl_names[$i]."</option>\n";
}
echo "</select>\n";
// Closing connection.
mysql_close($link);
?>
--
http://www.php.net/manual/en/function.mysql-tablename.php
http://master.php.net/manage/user-notes.php?action=edit+18067
http://master.php.net/manage/user-notes.php?action=delete+18067
http://master.php.net/manage/user-notes.php?action=reject+18067