hey.
i'm attampting to have a php script add tables to a mysql database.
it works fine when you have it just add one table. but if you try to add to or more at the same time it doesnt do it.
here is my code:
<?
$dbh = mysql_connect($hostname, $username, $password)
or die("Unable to connect to mysql");
$selected = mysql_select_db("$database",$dbh)
or die("Could not select database ($database)");
if (mysql_query("
CREATE TABLE content
(
ID INT NOT NULL AUTO_INCREMENT,
title TEXT NOT NULL,
body TEXT NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE links
(
ID INT NOT NULL AUTO_INCREMENT,
page_title TEXT NOT NULL,
link TEXT NOT NULL,
PRIMARY KEY (ID)
);
")) {
print "successfully added tables<br>";
}
else {
print "Failed to add tables<br>";
}
mysql_close($dbh);
?>
it connects to the database fine, like i said it will do it if i only have one CREATE TABLE part in there, but if i have the second one..CREATE LINKS, it doesn't work.
any help would be appreciated
Thanks
Chris