短消息删除错误的临时解决方法
2009-03-18 00:21:23 来源:WEB开发网
下载最新版本无这个错误,已经修正、 此前下载的,或者目前存在删除错误的请下载最新的安装包,或者按以下修改
查找require/msg.php
function delete_msgc($ids = null) {
.............
}
// ..........为省略
把整个函数替换成
function delete_msgc($ids = null) {
$GLOBALS['db']->update("DELETE pw_msgc FROM pw_msgc LEFT JOIN pw_msg ON pw_msgc.mid= pw_msg.mid LEFT JOIN pw_msglog ON pw_msgc.mid= pw_msglog.mid WHERE pw_msg.mid is NULL AND pw_msglog.mid is NULL".($ids ? " AND pw_msgc.mid IN($ids)" : ''));
}
或者用附件直接覆盖
原因是,Mysql版本太低的话,导致SQL执行出错。Mysql5.X以上不会出现此错误。
如还没有解决,请按下面说明处理:
require/msg.php
$GLOBALS['db']->update("DELETE mc FROM pw_msgc mc LEFT JOIN pw_msg m ON mc.mid=m.mid LEFT JOIN pw_msglog ml ON mc.mid=ml.mid WHERE m.mid is NULL AND ml.mid is NULL".($ids ? " AND mc.mid IN($ids)" : ''));
替换成:
MYSQL 4.0.x版本
$GLOBALS['db']->update("DELETE pw_msgc FROM pw_msgc mc LEFT JOIN pw_msg m ON mc.mid=m.mid LEFT JOIN pw_msglog ml ON mc.mid=ml.mid WHERE m.mid is NULL AND ml.mid is NULL".($ids ? " AND mc.mid IN($ids)" : ''));
MYSQL 3.x版本
global $db;
$mids = '';
$query = $db->query("SELECT mc.mid FROM pw_msgc mc LEFT JOIN pw_msg m ON mc.mid=m.mid LEFT JOIN pw_msglog ml ON mc.mid=ml.mid WHERE m.mid is NULL AND ml.mid is NULL".($ids ? " AND mc.mid IN($ids)" : ''));
while ($rt = $db->fetch_array($query)) {
$mids .= ($mids ? ',' : '').$rt['mid'];
}
if ($mids) {
$db->update("DELETE FROM pw_msgc WHERE mid IN($mids)");
}
附件:require_msg.zip
更多精彩
赞助商链接