Login   Register  
PHP Classes
elePHPant
Icontem

File: show_databases.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mark Documento  >  Database Connection Classes  >  show_databases.php  >  Download  
File: show_databases.php
Role: Example script
Content type: text/plain
Description: Sample script 1
Class: Database Connection Classes
Abstract the access to SQL databases
Author: By
Last change:
Date: 2006-09-17 22:47
Size: 636 bytes
 

Contents

Class file image Download
<?php

try
{
    include_once(
"connection.inc.php");
    include_once(
"mysql_database.inc.php");

    
$db DBFactory::CreateDatabaseObject("MySqlDatabase");
    
$db->Connect($server$database$username$password);

    
$dt $db->Execute("SHOW DATABASES");
    
$content "DATABASES:<br>";
    while (
$dt->MoveNext())
    {
        
$content .= "$dt->Database<br>";
        
// or use:
        //$content .= $dt->Field(0) . "<br>";
    
}
}
catch (
Exception $ex)
{
    
$content "Exception Caught: " $ex->getMessage() .
               
"<p>Trace: " $ex->getTraceAsString() . "</p>";
}

echo 
$content;

?>