1.	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2.		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3.	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4.	<head>
5.		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
6.		<title>Create a Table</title>
7.	</head>
8.	<body>
9.	<?php // Script 12.4 - create_table.php 
10.	/* This script connects to the MySQL server, selects the database, and creates a table. */
11.	
12.	// Connect and select:
13.	if ($dbc = @mysql_connect('h41mysql35.secureserver.net', 'yrosenthal', 'Password.1')) {
14.		
15.		// Handle the error if the database couldn't be selected:
16.		if (!@mysql_select_db('yrosenthal')) {
17.			print '<p style="color: red;">Could not select the database because:<br />' . mysql_error() . '.</p>';
18.			mysql_close();
19.			$dbc = FALSE;
20.		}
21.	
22.	} else { // Connection failure.
23.		print '<p style="color: red;">Could not connect to MySQL:<br />' . mysql_error() . '.</p>';
24.	}
25.	
26.	if ($dbc) {
27.	
28.		// Define the query:
29.		$query = 'CREATE TABLE entries (
30.	entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
31.	title VARCHAR(100) NOT NULL,
32.	entry TEXT NOT NULL,
33.	date_entered DATETIME NOT NULL
34.	)';
35.		
36.		// Execute the query:
37.		if (@mysql_query($query)) {
38.			print '<p>The table has been created.</p>';
39.		} else {
40.			print '<p style="color: red;">Could not create the table because:<br />' . mysql_error() . '.</p><p>The query being run was: ' . $query . '</p>';
41.		}
42.			
43.		mysql_close(); // Close the connection.
44.	
45.	}
46.	?>
47.	</body>
48.	</html>