在mysql里执行是通过的,但在php下不执行?去掉语句中C相关项可以执行;求解答,怎么解决?

function updateIndexResult() {
$IndexDatas = D();
$sql = "update data_name a,cal_result b,(select data_id,hhh,max(result_id) max_result_id from cal_result group by data_id) c set a.hhh=b.hhh,";
$sql .= "a.data_updated_time=unix_timestamp(now())";
$sql .= 'where a.data_id=b.data_id and b.data_id=c.data_id and b.result_id=c.max_result_id)';
$result = $IndexDatas->execute($sql);
return $t_result;
}
return $t_result;应该是return $result;
这段代码是写在数据处理模型里的,然后在主程序里执行这个函数:$dp->updateIndexResult();,去掉update中的C就能执行,如此却执行不到数据。。。把这段完整代码用mysql直接执行也是没有问题的,不知何故??
/***问题解决了!!!!!原来是这句结尾处多了个括弧,瞬间晕倒在地,不省人事。。。
$sql .= 'where a.data_id=b.data_id and b.data_id=c.data_id and b.result_id=c.max_result_id)';

把$sql用var_dump输出,然后拿到mysql里执行看看结果。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-04-11
.........

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网