dongqiao1151 2018-12-21 07:14
浏览 31

if语句内没有显示空标记[重复]

This question already has an answer here:

Building a custom site for non-profit. Have a hang up on the search page.

Here is what I have...

It shows results but does not show anything for empty results. I can not figure this one out.

while($rowitem = mysqli_fetch_array($results)) 
    {

         If (empty($results))  
          {    

       echo 'NO RESULTS';


          }
         Else
         {
            echo  "<div>"; ..... 

There is a lot of code past this that works.

I appreciate any help that anyone can provide. I am sure it is something simple that I am screwing up.

</div>
  • 写回答

2条回答 默认 最新

  • dongmei8071 2018-12-21 07:18
    关注

    while loop will not run in case of empty results so you need to check before while:

    if(empty($results)){
        echo 'NO RESULTS';
    else{
        while($rowitem = mysqli_fetch_array($results)) {
            /* your code here */
        }
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度