Reply
list the tables in a database
Old 07-21-2004, 09:06 PM what is the correct name indice in array that list tables
Experienced Talker

Posts: 34
I am trying to list the tables in a database, I have the wrong
array indice name I have tried

$row['Table']
$row['table'];
$row['Tables']

with no luck . I use a simliar script to list the databases on my server I used $row['Database'] instead and it worked so it has to be the name on the table indice. can someone help.

script listed below

<?php

$connection = mysql_connect('localhost', "administrator","bulls23") or die(mysql_error());

$dbname = $_GET['db'];


$table_result= mysql_list_tables($dbname)or die(mysql_error());



while($row=mysql_fetch_array($table_result)){

echo '<input type="radio" name="tblnames" value="'.$row['Table'].'" onClick="self.location.href = \'info.htm?table='.$row['Table'].'\'">'.$row['Table'].'<br>';

}

?>

Last edited by cedtech23 : 07-21-2004 at 09:36 PM.
cedtech23 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 07-21-2004, 09:37 PM
Christopher's Avatar
Iced Cap

Posts: 3,111
Location: Toronto, Ontario
Just use mysql_fetch_row (as to mysql_fetch_array) and use $row[0].

You can find what the array key is by passing it to print_r.

PHP Code:
print_r($row); // will print: Array( [key] => value ) 
Christopher is offline
Reply With Quote
View Public Profile Visit Christopher's homepage!
 
Reply     « Reply to list the tables in a database
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11052 seconds with 12 queries