sql 语句在phpmyadmin运行正常,但在PHP无法运行
$sql=<<<EOFDROPTABLEifexists`install`,`user`,`theme`,`reply`;createtable`install`(`id...
$sql=<<<EOF
DROP TABLE if exists `install`,`user`,`theme`,`reply`;
create table `install` (
`id` int(11) unsigned NOT NULL auto_increment,
`themenum` int(11) NOT NULL,
`webtitle` text NULL,
`weblogo` text NULL,
`webkeywords` text NULL,
`webdescription` text NULL,
`webtop` text NULL,
`webmenu` text NULL,
`webfooter` text NULL,
`custom1` text NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
);
EOF;
$resql=mysql_query($sql);
if($resql){
echo "<div align=center><h1>安装成功!请删除掉安装文件</h1><a href=index.php>查看首页</a></div>";
}
else{
$result=mysql_error();
echo "<div align=center>安装出错!<br>$result</div>";
}
出错信息:
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 `install` ( `id` int(11) unsigned NOT NULL auto_increment, `the' at line 2 展开
DROP TABLE if exists `install`,`user`,`theme`,`reply`;
create table `install` (
`id` int(11) unsigned NOT NULL auto_increment,
`themenum` int(11) NOT NULL,
`webtitle` text NULL,
`weblogo` text NULL,
`webkeywords` text NULL,
`webdescription` text NULL,
`webtop` text NULL,
`webmenu` text NULL,
`webfooter` text NULL,
`custom1` text NULL,
PRIMARY KEY (`id`),
KEY `id` (`id`)
);
EOF;
$resql=mysql_query($sql);
if($resql){
echo "<div align=center><h1>安装成功!请删除掉安装文件</h1><a href=index.php>查看首页</a></div>";
}
else{
$result=mysql_error();
echo "<div align=center>安装出错!<br>$result</div>";
}
出错信息:
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 `install` ( `id` int(11) unsigned NOT NULL auto_increment, `the' at line 2 展开
2014-04-14
展开全部
你这是两条sql语句!,要分开执行的,去掉drop那句试试,或者选择分开执行!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询