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

search for in the

mysql_db_query> <mysql_data_seek
[edit] Last updated: Fri, 17 May 2013

view this page in

mysql_db_name

(PHP 4, PHP 5)

mysql_db_nameOttiene dei dati dal risultato

Descrizione

string mysql_db_name ( resource $risultato , int $riga [, mixed $ campo ] )

mysql_db_name() accetta come primo paramentro il puntatore al risultato dalla chiamata a mysql_list_dbs(). Il parametro riga è un indice compreso nell'intervallo del risultato.

Se intercorre un errore, viene restituito FALSE. Usare mysql_errno() e mysql_error() per determinare la natura dell'errore.

Example #1 Esempio di mysql_db_name()

<?php
    error_reporting
(E_ALL);

    
mysql_connect('dbhost''nome_utente''password');
    
$db_list mysql_list_dbs();

    
$i 0;
    
$conteggio mysql_num_rows($lista_db);
    while (
$i $conteggio) {
        echo 
mysql_db_name($lista_db$i) . "\n";
        
$i++;
    }
?>

Per motivi di compatibilità con il passato, anche mysql_dbname() è è accettata. Questo comunque è sconsigliato.



add a note add a note User Contributed Notes mysql_db_name - [1 notes]
up
-1
ericpp % bigfoot.com
8 years ago
If you just need the current database name, you can use MySQL's SELECT DATABASE() command:

<?php
function mysql_current_db() {
   
$r = mysql_query("SELECT DATABASE()") or die(mysql_error());
    return
mysql_result($r,0);
}
?>

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