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
 



Create Dynamic Web Pages Using PHP and MySQL    (ISBN: 0201734028)


 

 List Price: $39.99
 Our Price: $27.99
 Used Price: $12.98

 Release Date: 28 November, 2001
 Manufacturer: Addison-Wesley Pub Co (Paperback)
 Sales Rank: 190,135

 Author: David Tansley









More Info

 Create/Drop Databases 2003-02-17 00:19:07
  php 
Category: source:php:database
Description: Creates and drops a database from mysql.
Platform: all
Author: detour
Viewed: 2552
Rating: 2.5/5 (15 votes)
If you have any questions about this piece of code or still need help, try posting your question on the forum.

 

Printable Version
crtdrpdb.php
<?php
  // listdbproc.php by detour@metalshell.com
  //
  // Creates and drops a database from mysql.
  //
  // http://www.metalshell.com/
  //


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

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

  $dbid = mysql_connect($dbhost, $dbuser, $dbpass) or die("Error Connecting");

  // Create the database.
  if (mysql_create_db("metal-newdb")) {
    echo('Database created.<br>');
    echo('Now attempting to remove database...<br>');

    // Drop the newly created database.
    if(mysql_drop_db("metal-newdb")) {
      echo('Database removed.');
    } else {
      echo('Error: ' . mysql_error());
    }
  } else {
    echo('Error: ' . mysql_error());
  }

  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?