原帖由 ddycw 于 2005-9-3 00:57 发表
Discuz! info: MySQL Query Error
User: 淡淡烟草味
Time: 2005-9-3 12:57am
Script: /slbbs/home/pm.php
SQL: SELECT uid,username FROM cdb_members WHERE uid IN (SELECT msgfromid from cdb_pms WHER ...
MYSQL 版本不支援的作如下收改!!
這是要加到 pm.php 的那一段的開頭內容
將開頭那段 :
- if(!submitcheck('archivesubmit')) {
- $query = $db->query("SELECT uid,username FROM $table_members WHERE uid IN (SELECT msgfromid from cdb_pms WHERE msgtoid = $discuz_uid AND folder = 'inbox')");
- while(@$msgfromlist = $db->fetch_array($query)){
- $msgfromid .= ($msgfromid)?",":"";
- $msgfromuser .= ($msgfromuser)?"||":"";
- $msgfromid .= $msgfromlist[uid];
- $msgfromuser .= $msgfromlist[username];
- }
- $query = $db->query("SELECT uid,username FROM $table_members WHERE uid IN (SELECT msgtoid from cdb_pms WHERE msgfromid = $discuz_uid AND folder = 'outbox') ");
- while(@$msgtolist = $db->fetch_array($query)){
- $msgtoid .= ($msgtoid)?",":"";
- $msgtouser .= ($msgtouser)?"||":"";
- $msgtoid .= $msgtolist[uid];
- $msgtouser .= $msgtolist[username];
- }
- } else {
复制代码
整段改為 :
- if(!submitcheck('archivesubmit')) {
- $members = "";
- $query = $db->query("SELECT msgfromid from cdb_pms WHERE msgtoid = $discuz_uid AND folder = 'inbox'");
- while (@$member = $db->fetch_array($query)){
- $members .= ($members)?",":"";
- $members .= $member['msgfromid'];
- }
- if ($members){
- $query = $db->query("SELECT uid,username FROM $table_members WHERE uid IN ($members)");
- while(@$msgfromlist = $db->fetch_array($query)){
- $msgfromid .= ($msgfromid)?",":"";
- $msgfromuser .= ($msgfromuser)?"||":"";
- $msgfromid .= $msgfromlist[uid];
- $msgfromuser .= $msgfromlist[username];
- }
- }
- $members = "";
- $query = $db->query("SELECT msgtoid from cdb_pms WHERE msgfromid = $discuz_uid AND folder = 'outbox'");
- while (@$member = $db->fetch_array($query)){
- $members .= ($members)?",":"";
- $members .= $member['msgtoid'];
- }
- if ($members){
- $query = $db->query("SELECT uid,username FROM $table_members WHERE uid IN ($members) ");
- while(@$msgtolist = $db->fetch_array($query)){
- $msgtoid .= ($msgtoid)?",":"";
- $msgtouser .= ($msgtouser)?"||":"";
- $msgtoid .= $msgtolist[uid];
- $msgtouser .= $msgtolist[username];
- }
- }
- } else {
复制代码
錯誤原因 -> MYSQL版本不支援在IN()中的SELECT SUBQUERY語法,MYSQL可能是使用 4.1 前版本
[ 本帖最后由 BBghost2004 于 2005-9-3 13:40 编辑 ] |