Jump to content

mysql_query(file_get_contents('import-db.sql')) or die(mysql_error());


scarhand

Recommended Posts

This code:

 

mysql_query(file_get_contents('import-db.sql')) or die(mysql_error());

 

Is throwing this error:

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE IF NOT EXISTS `replies` ( `id` int(10) unsigned NOT NULL AUTO_IN' at line 8

 

Heres the contents of import-db.sql:

 

CREATE TABLE IF NOT EXISTS `categories` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `slug` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
);

CREATE TABLE IF NOT EXISTS `replies` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_thread` int(10) unsigned NOT NULL,
  `username` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `the_date` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.