Comunitatea PHP Romania
 

 
mysql_list_tables

mysql_list_tables

(PHP 3, PHP 4 , PHP 5)

mysql_list_tables -- List tables in a MySQL database

Description

resource mysql_list_tables ( string database [, resource link_identifier])

mysql_list_tables() takes a database name and returns a result pointer much like the mysql_query() function. Use the mysql_tablename() function to traverse this result pointer, or any function for result tables, such as mysql_fetch_array().

The database parameter is the name of the database to retrieve the list of tables from. Upon failure, mysql_list_tables() returns FALSE.

For downward compatibility, the function alias named mysql_listtables() can be used. This is deprecated however and is not recommended.

Notã: The function mysql_list_tables() is deprecated. It is preferable to use mysql_query() to issue a SQL SHOW TABLES [FROM db_name] [LIKE 'pattern'] statement instead.

Exemplu 1. mysql_list_tables() example

<?php
$dbname
= 'mysql_dbname';

if (!
mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
    echo
'Could not connect to mysql';
    exit;
}

$result = mysql_list_tables($dbname);

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);
?>

See also mysql_list_dbs() and mysql_tablename().

Ultimele discutii in forum RSS Forum

Ultimele articole Ultimele articole

Top membri

Pirahna Pirahna
la birou
carco carco
Bucuresti
Birkoff Birkoff
Bucuresti
Mascka Mascka
Braila
raul_ raul_
whooper whooper
Toronto ON
mihaitha mihaitha
Sibiu
gabysolomon gabysolomon
Bacau
oriceon oriceon
Constanta
garlicinicolae garlicinicolae

Newsletter


Email:
 inscriere
 renuntare
 
 Arhiva newsletter

Parteneriat

Copyright © 2001-2008 PHP Romania Add PHPRomania to Google Add PHPRomania to Del.icio.us Add PHPRomania to Stumbleupon Add PHPRomania to Yahoo! Add PHPRomania to Digg Add PHPRomania to Blink Personal Loans | Best Credit Cards | Personal Loans | Loans | Magazine Subscriptions
Ads: Partener Way2Web Nework: gazduire web | inregistrare domenii | web design | imobiliare | web hosting
Powered by Simplis