SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
-
Dec 3, 2000, 00:25 #1
- Join Date
- Jul 2000
- Posts
- 69
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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.
-
Dec 3, 2000, 00:36 #2
- Join Date
- Jul 1999
- Location
- Helena, MT
- Posts
- 287
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Dec 3, 2000, 00:42 #3
- Join Date
- Aug 2000
- Location
- Silicon Valley
- Posts
- 2,241
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
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
-
Dec 3, 2000, 01:17 #4
- Join Date
- Aug 2000
- Location
- San Diego, CA
- Posts
- 5,460
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
<?
$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.
-
Dec 3, 2000, 14:37 #5
- Join Date
- Jul 2000
- Posts
- 69
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks guys
Bookmarks