当前位置: 首页 > 图文教程 > 数据库 > MYSQL > mysql 1046错误解决实例

MYSQL
有了MySQL,客户资源管理尽在掌握
将现有的Access数据库升级为SQL
MySQL修改密码方法总结
MySQL以速度为目标
在ACCESS 中调用后台存储过程
MySQL怎样优化WHERE子句
向MySQL增加新用户权限
MySQL的数据类型和建库策略
如何修护MYSQL数据表
如何锁定MYSQL数据表
MySQL优化全攻略-服务器参数调整
mysql数据复制到access数据库
如何远程连接SQL Server数据库
MY SQL常用命令
MySQL5 改密码后不能登录问题的解答
如何在windows系统下安装MySQL
MySQL各存储引擎(INNODB,MyISAM等)的区别及其启动方法
MySQL 平台数据库备份方案详细说明
ASP使用MySQL数据库全攻略
MySQL V4.1 乱码终极解决方案

MYSQL 中的 mysql 1046错误解决实例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-30   浏览: 55 ::
收藏到网摘: n/a

mysql 1046错误解决:

<?php
require_once './include/common.inc.php';

$maxpostnum = 200; //设定最小帖子数量


if(!$discuz_user || !$discuz_pw) {
        showmessage('对不起,您还没有登录,无法进行此操作。');
}

if(!$adminid ){
$query=$db->query("SELECT postnum,credit FROM bbs.cdb_members WHERE username = '$discuz_user'");
$blogaccess = $db->fetch_array($query);
        if ($blogaccess['postnum'] < $maxpostnum ){
        showmessage ('对不起,您目前的等级无开通RSS聚合服务');
        }
}

$query=$db->query("SELECT username FROM uploader.uploader_users WHERE username = '$discuz_user'");
$bloguser = $db->fetch_array($query);
        if ($action=="") {
        include template('rss_reg');       
        }
       
        if ($action == "kaihu" ){
                if (!$bloguser['user']){
                $query=$db->query("SELECT uid,username,password,email,regdate FROM bbs.cdb_members WHERE username = '$discuz_user'");
                $bloginfo = $db->fetch_array($query);
                        $db->query("INSERT INTO uploader.uploader_users (username, password, email, reg_date)
                        VALUES ('$bloginfo[username]' ,'$bloginfo[password]' ,'$bloginfo[email]' ,'$bloginfo[regdate]'");
                        $db->query("UPDATE bbs.cdb_members SET rss = 1 WHERE username = '$discuz_user'");
                showmessage('帐户开通完毕,您可以进入管理了','http://rss.twbbs.biz');
        }else {
                $db->query("UPDATE bbs.cdb_members SET rss =1 WHERE username = '$discuz_user'");
                showmessage('你的帐户已经开通','http://rss.twbbs.biz');
        }              
        }
?>

SQL: INSERT INTO uploader.uploader_users (username, password, email, reg_date)
VALUES ('sa' ,'40c76244e235aa23e73acb4a457f9748' ,'[email protected]' ,'1132236495'
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 '' at line 2
Errno.: 1064

必須還得 把 uploader_users  id 也按 bbs.cdb_member 裏麵的ID插入嗎?

解决方法:

PHP代码:

$db->query("INSERT INTO uploader.uploader_users (username, password, email, reg_date)
           VALUES ('$bloginfo[username]' ,'$bloginfo[password]' ,'$bloginfo[emal]' ,'$bloginfo[regdate]'");

换成:

PHP代码:

$db->query("INSERT INTO uploader.uploader_users (username, password, email, reg_date)
           VALUES ('$bloginfo[username]' ,'$bloginfo[password]' ,'$bloginfo[emal]' ,'$bloginfo[regdate]')");

原因:少了一个右括号。