Home
 
 
Search:  
C C++ Perl PHP Python HTML ShellScripts
 
 
  Coding Books
  Tutorials
  Search Code
  Browse Code
  Link to Us
  Site News
  Contact Metalshell
 
 
 
  Submit Code   Statistics
 



PHP and MySQL Web Development    (ISBN: 0672317842)


 

 List Price: $49.99
 Our Price: $49.99
 Used Price: $30.00

 Release Date: 30 March, 2001
 Manufacturer: Sams (Paperback)
 Sales Rank: 2,783

 Author: Luke Welling, Laura Thomson









More Info

 List Databases 2003-02-17 00:16:03
  php 
Category: source:php:database
Description: List all databases availible in mysql.
Platform: all
Author: detour
Viewed: 2733
Rating: 3.2/5 (11 votes)
If you have any questions about this piece of code or still need help, try posting your question on the forum.

 

Printable Version
listdb.php
<?php
  // listdb.php by detour@metalshell.com
  //
  // List all databases availible in mysql.
  //
  // http://www.metalshell.com/
  //


  $dbuser = "user";
  $dbpass = "pass";
  $dbhost = "localhost";

  echo('<html><head><title>Database List</title></head><body>');
  echo('<font face="arial" style="font-weight:bold">');

  // Connect to mysql
  $dbid = mysql_connect($dbhost, $dbuser, $dbpass);

  // Get the list.
  $db_list = mysql_list_dbs($dbid);

  echo('<H1>Availible Databases</H1>');
  // Process each row as an object.
  while($row = mysql_fetch_object($db_list)) {
    // Print out the database name.
    echo $row->Database . "<br>";
  }

  // Close connection.
  mysql_close($dbid);

  echo('</body></html>');
?>
Rate this code:
(Not Helpful)  (Very Helpful) 

 
 
   Developer.*  
   Blue Parrots  
   Technipal  
   Defy Magazine  
   Code Project  
   Prog. Heaven  


Got Money?