Home  >  Article  >  Backend Development  >  while 嵌套if 没法执行

while 嵌套if 没法执行

WBOY
WBOYOriginal
2016-06-13 12:45:421070browse

while 嵌套if 无法执行

<br />
$result = mysql_query("select title  from hello where title like '%$info%'");<br />
<br />
while($row=mysql_fetch_array($result))//通过循环读取数据内容<br />
  {<br />
    if(!$row)<br />
     {<br />
     	echo '1';<br />
     }<br />
     else<br />
     {<br />
     	echo '2';<br />
     }<br />
<br />
  }<br />
<br />


以上语句中,只有当$row有结果的时候才会输出,就是说只会输出2,而没结果的时候,没有任何输出,即不会输出1,不知道啥原因,求解。

Statement:
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