程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> 1046錯誤解決實例

1046錯誤解決實例

編輯:關於MYSQL數據庫

<?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]')");

原因:少了一個右括號。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved