query($sql)) {       $results = "/> query($sql)) {       $results = ">
Home > Backend Development > PHP Tutorial > smarty?sql 报错

smarty?sql 报错

WBOY
Release: 2016-06-13 12:24:51
Original
900 people have browsed it

smarty?sql 出错

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