<?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))
{
$message = "<h5>Database \"$database\" exists.</h5>";
$exists = mysql_query("SELECT 1 FROM customer LIMIT 0", $link);
if ($exists)
{
// DROP THE TABLE
$sql = "DROP TABLE customer";
mysql_query($sql, $link) or die(mysql_error());
}
}
else
{
$message = "<h5>Database \"$database\" must be created before creating or dropping a table.</h5>";
}
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 TABLE customer</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 TABLE customer</h1>
<?php
echo "<p>".$sql."</p>\n";
dump_page(basename($_SERVER[SCRIPT_FILENAME])); // Display the code of this page
?>
</td>
</tr>
</table>
</body>
</html>
|