thanks for the reply....
I am running this current script but it can only create the first table in the database...I don't know why.
Am I missing something here?
PHP code
Code:
<?php
$link = mysql_connect('localhost', 'username', 'password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$sql = 'CREATE DATABASE test2';
if (mysql_query($sql, $link)) {
echo "Database test2 created successfully\n";
} else {
echo 'Error creating database: ' . mysql_error() . "\n";
}
// Create tables in test2 database
mysql_select_db("test2", $link);
$sql = "CREATE TABLE car (
title varchar(255) NOT NULL,
description varchar(255) NOT NULL,
priority tinyint(2) NOT NULL default '0'
) TYPE=InnoDB\n";
mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();
//Create links table
$sql = "CREATE TABLE links (
type varchar(20) NOT NULL default '',
resource varchar(255) NOT NULL,
) TYPE=InnoDB\n";
mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();
//Create home table
$sql = "CREATE TABLE home (
name varchar(255) NOT NULL,
title varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
) TYPE=InnoDB\n";
mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();
//Create people table
$sql = "CREATE TABLE people (
name varchar(20) NOT NULL default '',
address varchar(255) NOT NULL
resource varchar(255) NOT NULL,
) TYPE=InnoDB\n";
echo "car,home,links, & people tables in the relational database (".test2.") have been successfully created!\n";
mysql_query($sql, $link);
if (mysql_error()) echo __line__.") Error creating table: ".mysql_error();
mysql_close($link);//Close connection
?>
Bookmarks