Current location: Hot Scripts Forums » Programming Languages » PHP » show tables question


show tables question

Reply
  #1 (permalink)  
Old 04-19-09, 03:08 PM
maklooby maklooby is offline
Newbie Coder
 
Join Date: Feb 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
show tables question

I'm trying to use the SHOW TABLES command in order to show my tables that I've created in mysql database. HOwever, I have questions.

My code:
$sql="SHOW TABLES FROM food";
$result=mysql_query($sql);
if (!$result) {
echo "DB Error, could not list tables\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
while ($row = mysql_fetch_row($result)) {
echo "Table: {$row[0]}\n";
}

mysql_free_result($result);
?>

The output does show the tables. BUT it shows the word TABLE in front of my table names. I do not want the word table to show up. In fact, I would actually if posible like my tables to be links that a user can click on to bring up information (or in my case more php code of that link. I just thought that displaying the tables is better than manually creating an array and changing each time someting gets done...less tedious anyways.
Any suggestions on this? Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 04-19-09, 06:47 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
Ummmmmmm..........
PHP Code:

echo "Table: {$row[0]}\n"
I'm guessing you didn't write the code and don't know how to read it.
__________________
The toxic ZCE
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
slide show question maklooby JavaScript 4 03-13-09 08:03 PM
question about tables mejnoona PHP 6 12-06-08 03:19 AM
Show Tables blinn_shade PHP 10 09-26-07 01:22 AM
borders dont show in firefox (tables) Bazzio CSS 5 09-05-05 04:43 PM
tables and PHP, odd question eq1987 PHP 3 07-04-04 01:30 PM


All times are GMT -5. The time now is 01:31 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.