21,886
社区成员
发帖
与我相关
我的任务
分享
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 'as m' at line 1 [ SQL语句 ] : SHOW COLUMNS FROM y_msgs as m
错误位置
FILE: /data/www/qingqu/ThinkPHP/Lib/Driver/Db/DbMysql.class.php LINE: 320
TRACE
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Driver/Db/DbMysql.class.php (320) trace(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 'as m' at line 1
[ SQL语句 ] : SHOW COLUMNS FROM y_msgs as m, , ERR)
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Driver/Db/DbMysql.class.php (107) DbMysql->error()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Driver/Db/DbMysql.class.php (215) DbMysql->query(SHOW COLUMNS FROM y_msgs as m)
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/Model.class.php (135) DbMysql->getFields(y_msgs as m)
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/Model.class.php (123) Model->flush()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/Model.class.php (1156) Model->_checkTableInfo()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/Model.class.php (98) Model->db(0, )
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Common/common.php (277) Model->__construct(Msgs as m, , )
[15-05-28 22:56:05] /data/www/qingqu/admin/Lib/Action/MsgAction.class.php (27) M(Msgs as m)
[15-05-28 22:56:05] () MsgAction->index()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/App.class.php (169) ReflectionMethod->invoke()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/App.class.php (205) App::exec()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Lib/Core/Think.class.php (39) App::run()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/Common/runtime.php (243) Think::start()
[15-05-28 22:56:05] /data/www/qingqu/ThinkPHP/ThinkPHP.php (30) require(/data/www/qingqu/ThinkPHP/Common/runtime.php)
[15-05-28 22:56:05] /data/www/qingqu/admin.php (6) require(/data/www/qingqu/ThinkPHP/ThinkPHP.php)
<?php
require './login.inc.php';
require './init.inc.php';
class MsgAction extends Action{
public function index(){
header('Content-Type:text/html;charset=utf-8');
load('extend');
import("ORG.Util.Page");
$m = M('Msgs');
$count = $m->count();
$page = new Page($count,20);
$show = $page->show();
if (isset($_GET['allmsg']) && isset($_GET['act'])){
if ($_GET['allmsg'] ==0 && $_GET['act']=='nread'){
$list = checkTrip(M('Msgs as m')->join('y_goods as g on m.m_tit = g.goods_num')->where('m_status=0')->order('m_id desc')->select());
}
$this->assign('list',$list);
$this->display();
return;
}
if (!isset($_GET['search'])){
$list = checkTrip(M('Msgs as m')->join('y_goods as g on m.m_tit = g.goods_num')->order('m_time desc')->limit($page->firstRow.','.$page->listRows)->select());
}else{
$sql = '';
if (isset($_GET['allmsg'])){
if ($_GET['allmsg']!='status'){
$sql = 'm.m_status='.$_GET['allmsg'];
}
}
$methodone = isset($_GET['search_bzb']) ?$_GET['search_bzb'] : '';
$bzb = $_GET['bzb'];
if ($bzb !== ''){
$and = (isset($_GET['allmsg']) && $_GET['allmsg']!='status') ? ' and ' : '';
$sql .= $and.$methodone.' like "%'.$bzb.'%"';
}
$methodtwo = $_GET['search_tdb'];
$px = $_GET['order'];
$order = $methodtwo.' '.$px;
foreach ($_GET as $k=>$v){
if ($_GET[$k]==='') unset($_GET[$k]);
}
$count = $m->where($sql)->order($order)->count();
$page = new Page($count,20);
$show = $page->show();
$list = checkTrip(M('Msgs as m')->join('y_goods as g on m.m_tit = g.goods_num')->where($sql)->order($order)->limit($page->firstRow.','.$page->listRows)->select());
foreach($list as $key=>$val){
$val[$methodone] = str_replace($bzb,'<p>'.$bzb.'</p>',$val[$methodone]);
$list[$key][$methodone] = $val[$methodone];
}
}
$this->assign('list',$list);
$this->assign('page',$show);
$this->display();
}
public function readMsg(){
header('Content-Type:text/html;charset=utf-8');
load('extend');
$m = M('Msgs');
$mid = isset($_GET['mid']) ? intval($_GET['mid']) : 1;
$list = checkTrip(M('Msgs as m')->join('y_goods as g on m.m_tit = g.goods_num')->where('m_id='.$mid)->find());
$this->assign('list',$list);
if ($list['isread']!=1){
$data['m_status'] = 1;
$m->where('m_id='.$mid)->save($data);
}
$this->display();
}
public function delNew(){
header('Content-Type:text/html;charset=utf-8');
$m = M('Msgs');
$ids = rtrim($_GET['mid'],',');
if ($m->where('m_id in('.$ids.')')->delete()){
echo '<script>alert("删除成功");location.href="'.__URL__.'"</script>';
}else{
echo '<script>alert("删除失败");location.href="'.__URL__.'"</script>';
}
}
}