<?php
$host="mysql153.secureserver.net";
$uname="java2s";
$pass="password";
$database="java2s";
$tablename="mytable";
$connection= mysql_connect ($host, $uname, $pass) or die ("Database connection failed!");
$result=mysql_select_db ($database) or die ("Database could not be selected");
$query = "create table ". $tablename ." (name varchar (20) Not Null, email varchar (40) Not Null)";
$result = mysql_query ($query);
if (! $result) {
die ("Query could not be executed.");
} else {
echo $tablename." created in the megabase database.\n";
}
?>
|