Jul 26, 2008

An Sql Problem In Php - returnin the name of the tables

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

An Sql Problem In Php - returnin the name of the tables

spy_charly
hello again guys!, i was wondering if there is a way to get the table names from my database using php. Well what i want to do is to get the name of the tables returned as an array or something similar...
thanx in advance

Reply

rvalkass
You can use an SQL command to list all of the table names in a database.

For example:
CODE

<?php
mysql_connect(localhost,username,password);
$query = "SHOW TABLES FROM database";
$tables = mysql_query($query);
?>


The variable $tables will then contain all of the names of the tables.

Hope this helps you.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : sql php returnin tables

  1. Compare 2 List Of User Ids From Different Tables - (1)
  2. Dynamically Select From 2 Tables Based On Id - dynamically select from 2 tables based on id (1)
    hi there, im working on a performance request system, and i have three tables that im working with
    right now. the performances table holds the info about the performance (date, times, status, etc.),
    and has two columns, org_type and org_id, which both hold an int value to tell me where the
    organization info is. there are two org types which have respective tables, because we collect
    different information based on the type of org that is registering. is there any way to select info
    from all three tables (dynamically selecting between the two org tables based on org_type,...
  3. Creatin Tables In Mysql - (4)
    Hi everyone!
    I have a problem: when I create a table in MySQL,
    I'm asked to fill up some information about each colum.

    for example:
    | Name | Type | Value | 2nd Value | Attib...
  4. Problem To Join Tables In Database - Problem in joining (many to many) relation (3)
    Please help me. I'm building a group of database fro a program. the situation is like this:
    'user' may have 1 or more class(es). 'class' itself may have 1 or more user in its
    classroom. I'm bad at explaining... maybe like this: A program is made to write data of
    classroom. Hikaru has a math class at Monday and statistic class at Tuesday. The math class itself
    consists of about 50 students in a classroom. So, Hikaru (user ) may have one or more class at
    time, math class (class) may have one or more students at time. So, basically I must mak...



Looking for sql, problem, php, returnin, tables

Searching Video's for sql, problem, php, returnin, tables
advertisement



An Sql Problem In Php - returnin the name of the tables



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE