运行安装接口程序出现以下错误: You have an error in your SQL syntax; check the manual that corr

msn_1107 2014-01-14 10:12:38
新手求教:
改别人写的网站:运行时报错运行安装接口程序出现以下错误:
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 'add smallint NOT NULL default '0', add char(20) NOT NULL default '', add e' at line 2
数据库创建结构是这样的:
function InstallUserCOM(){
global $empire,$ecms_config;
$user_userfen="enewsuserfen";
$user_money="enewsmoney";
$user_salt="enewssalt";
$sql=$empire->query1("alter table ".$ecms_config['member']['tablename']."
add ".$ecms_config['memberf']['groupid']." smallint NOT NULL default '0',
add ".$ecms_config['memberf']['rnd']." char(20) NOT NULL default '',
add ".$user_userfen." mediumint(8) unsigned NOT NULL default '0',
add ".$user_money." float(11,2) NOT NULL default '0.00',
add ".$ecms_config['memberf']['userdate']." int(10) unsigned NOT NULL default '0',
add ".$ecms_config['memberf']['zgroupid']." smallint not null default '0',
add ".$ecms_config['memberf']['havemsg']." tinyint(1) not null default '0',
add ".$ecms_config['memberf']['userkey']." char(12) NOT NULL default '',
add ".$user_salt." char(8) NOT NULL default '',
add ".$ecms_config['memberf']['checked']." tinyint(1) not null default '1';");
if(!$sql)
{
echo"运行安装接口程序出现以下错误:<br><font color=red>".mysql_error()."</font><br><br><a href='index.php'>点击返回重新设置</a>";
exit();
}
db_close();
$empire=null;
echo"<script>self.location.href='index.php?setup=success';</script>";
exit();
}
不知道是哪里有问题求大神帮忙改下,谢谢!
...全文
1718 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhouda829829 2014-01-16
  • 打赏
  • 举报
回复
已经说得很明白了,SQL语句的语法有问题,很大可能就是你写错了 在对照着看看。
码无边 2014-01-15
  • 打赏
  • 举报
回复
add smallint NOT NULL default '0', add char(20) NOT NULL default 可知,你操作sql的时候,这些字段没有信息。
wwwwb 2014-01-14
  • 打赏
  • 举报
回复
你把SQL语句直接在MYSQL中运行看看结果如何 不要用保留字做字段名,如果一定要加`` `add`
ACMAIN_CHM 2014-01-14
  • 打赏
  • 举报
回复
SQL语句的语法上有问题,建议调试你的代码然后检查程序生成的SQL语句。

56,940

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧