Hey there everybody!
Me and a couple of others are currently making a CMS but we got a problem :(

Here is the code:

function ImportSQL()
	{
		$conn = mysql_connect($_POST['host'] . ":" . $_POST['port'], $_POST['user'], $_POST['pass']);
		mysql_select_db($_POST['vision_db'], $conn);
		$db_content = @file_get_contents("../sql/Database.sql");
		$query = mysql_query($db_content);
		if(!$query){
			return mysql_error();
		}else{
			return true;
		}
	}

and here is the 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 `navigation` ( `id` int(11) NOT NULL AUTO_INCREMENT, `url` te' at line 2

i hope to get an answer! TY :D

can you shoe us the code on database.sql

/*
VisionCMS - Database
---
This file is used by the install script. So do not delete!
*/
DROP TABLE IF EXISTS `navigation`;
CREATE TABLE `navigation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `url` text NOT NULL,
  `title` varchar(10) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `pages`;
CREATE TABLE `pages` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` text NOT NULL,
  `content` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `settings`;
CREATE TABLE `settings` (
  `id` int(11) NOT NULL,
  `title` text NOT NULL,
  `website` text NOT NULL,
  `servername` text NOT NULL,
  `core` text NOT NULL,
  `template` text NOT NULL,
  `admin_gmlevel` int(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `news`;
CREATE TABLE `news` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` text NOT NULL,
  `content` text NOT NULL,
  `author` text NOT NULL,
  `date` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `shoutbox`;
CREATE TABLE `shoutbox` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `msg` text NOT NULL,
  `author` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

there you go

Omg use google, this is a broadly discussed topic.

if (mysql_query("SOURCE file.sql"))
{
  echo "success";
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.