downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysql_list_fields> <mysql_insert_id
[edit] Last updated: Fri, 25 May 2012

view this page in

mysql_list_dbs

(PHP 4, PHP 5)

mysql_list_dbsList databases available on a MySQL server

Descrierea

resource mysql_list_dbs ([ resource $link_identifier = NULL ] )

Returns a result pointer containing the databases available from the current mysql daemon.

Avertizare

Această funcție este DEZAPROBATĂ începând cu PHP 5.4.0. Utilizarea acestei funcții este foarte nerecomandabilă.

Parametri

link_identifier

Conexiunea MySQL. Dacă identificatorul legăturii nu este specificat, se presupune că este ultima legătură deschisă cu ajutorul mysql_connect(). Dacă nu este găsită nici o astfel de legătură, se va încerca crearea uneia prin apelul mysql_connect () fără argumente. În caz că nici o conexiune nu este găsită sau stabilită, se va genera o eroare de nivelul E_WARNING.

Valorile întoarse

Returns a result pointer resource on success, or FALSE on failure. Use the mysql_tablename() function to traverse this result pointer, or any function for result tables, such as mysql_fetch_array().

Exemple

Example #1 mysql_list_dbs() example

<?php
// Usage without mysql_list_dbs()
$link mysql_connect('localhost''mysql_user''mysql_password');
$res mysql_query("SHOW DATABASES");

while (
$row mysql_fetch_assoc($res)) {
    echo 
$row['Database'] . "\n";
}

// Deprecated as of PHP 5.4.0
$link mysql_connect('localhost''mysql_user''mysql_password');
$db_list mysql_list_dbs($link);

while (
$row mysql_fetch_object($db_list)) {
     echo 
$row->Database "\n";
}
?>

Exemplul de mai sus va afișa ceva similar cu:

database1
database2
database3

Note

Notă:

Pentru compatibilitatea cu versiunile anterioare, următorul pseudonim dezaprobat poate fi utilizat: mysql_listdbs()

Vedeți de asemenea



add a note add a note User Contributed Notes mysql_list_dbs
matjung at hotmail dot com 27-Feb-2010 02:30
The result pointer contains only the databases for which the mysql_user has the select priviledge granted.

 
show source | credits | sitemap | contact | advertising | mirror sites