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

search for in the

mysql_db_query> <mysql_data_seek
Last updated: Fri, 18 Jul 2008

view this page in

mysql_db_name

(PHP 4, PHP 5, PECL mysql:1.0)

mysql_db_name — Ottiene 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
ericpp % bigfoot.com
16-Mar-2005 05:13
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);
}
?>

mysql_db_query> <mysql_data_seek
Last updated: Fri, 18 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites