Hi,
Can somebody help me?
I want to fill a dropdown menu with all the table names in a database using PHP. Any help is greatly Appreciated.
Thank you
Sang N.
| SitePoint Sponsor |
Hi,
Can somebody help me?
I want to fill a dropdown menu with all the table names in a database using PHP. Any help is greatly Appreciated.
Thank you
Sang N.


I am not sure how to do what you are wanting to do, but i am pretty sure you are going to need to use this function:
mysql_list_tables($database_name);
Chris Roane





Here is help for a Vietnamese fella!
Get an array that has table names as values
Do a loop, each loop generate sthing like:
<option>$names[$index]</option>
Is that good enough?![]()
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy





<?
$db = mysql_connect("localhost", "user", "pass");
$result = mysql_list_tables("dbname");
print '<select name="tables">';
for($i=0;$i<mysql_num_rows($result);$i++) {
$tmp = mysql_tablename($result, $i);
printf('<option value="%s">%s', $tmp, $tmp);
}
print '</select>';
?>
Please don't PM me with questions.
Use the forums, that is what they are here for.
Thanks guys
Bookmarks