HOME and CODE

PHP & MySQL Home
secure.php
nav.php
notes.php
Download Tutorial

DATABASE

Create Database
Drop Database
Re-Create All

TABLE

Create Table
Drop Table
Add Record
Update Record
Delete Record
Search
View all Records

MORE PHP

PHP Console Apps
PHP Web Apps

PHP and MySQL - DROP DATABASE foo

<!-- dropDB.php -->

<?php
  require "../secure.php";    // Contains host, username and password
	
  $link = mysql_connect($host,        // Host name
                        $user,        // User name 
                        $password)    // User password
          or die("<h5>Could not connect: </h5>" . mysql_error());
	
  if (mysql_select_db ($database))
  {
    $sql = "DROP DATABASE $database";
    $result = mysql_query($sql, $link)
              or die("<p>".mysql_error()."</p>");
  }

  mysql_close($link);
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META name="description" content="Tutorial for Linux, Apache, MySQL, SQL and PHP - LAMP">
<META name="keywords" content="tutorial, linux, apache, mysql, php, code, sql, lamp, lesson, lessons, example, examples, beginner, beginners, beginners' beginner's">
<title>PHP and MySQL - DROP DATABASE foo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>

<table border="1" cellspacing="0" cellpadding="4">
  <tr valign="top"> 
    <td><?php include "nav.php"; ?></td>
    <td>
<h1>PHP and MySQL - DROP DATABASE foo</h1>
<?php 
  echo "<p>".$sql."</p>\n";
  dump_page(basename($_SERVER[SCRIPT_FILENAME]));  // Display the code of this page
?>
    </td>
  </tr>
</table>



</body>
</html>