how to check if mysql query return no result(record not found) using php?

前端 未结 3 558
鱼传尺愫
鱼传尺愫 2020-12-17 06:13

i am passing images file names via textarea to php script to find information about each image in mysql db .The problem is i am trying to output those image file names that

3条回答
  •  情深已故
    2020-12-17 06:42

    You can use mysqli_num_rows() in mysqli

    if(mysqli_num_rows($result) > 0){
    
        while($row = mysqli_fetch_array($result))
        {
            $totalRows++;
    
            echo "";
            echo "" . $row['ID'] ."(".$totalRows. ")";
            echo "" . $row['name'] . "";
            echo "" . $row['imgPURL'] . "";
            echo "" . $row['imgUrl'] . "";  
            echo "";         
        }
    } else {
        echo "Not Found Image:".$line.'';
    }
    

提交回复
热议问题