Home > Backend Development > PHP Tutorial > smarty?sql 出错

smarty?sql 出错

WBOY
Release: 2016-06-20 12:48:29
Original
1008 people have browsed it

$sql= sprintf(" select * from table");if(!$error=$conn->query($sql)) {       $results = array();       while(!($error=$conn->fetchArray($results))) {  //这句出了问题       //我在本地上数据可以正常读取,放到正式服上,读取一次就停止了        ..............................        }}
Copy after login


请问可以怎么修改??


回复讨论(解决方案)

报什么错误,是方法不存在,还是怎么滴

对于 if(!$error=$conn->query($sql)) {
只有 $conn->query($sql) 返回假的时候才会进入 then 分支
而 $conn->query($sql) 返回假,就表示指令串 $sql 有错!

同样,while(!($error=$conn->fetchArray($results))) {
也只有在 $conn->fetchArray 返回假的时候才会进入循环体

这与 smarty 无关,smarty 并没有提供数据库操作

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template