SQL在win下正常运行,但是Linux下就报错,求指点

框架是ThinkPHP 3.1
迁移到Linux服务器后就在报错,原本的Win服务器很正常.
debug信息如下:
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>';
}
}
}


望各位不吝赐教
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值