php - display "result not found" if no result in database -


i want display message "result not found" if user search not exits in database.
here code didnt works.

can tell me what's wrong code?

 <?php         include 'database_conn.php';          $eventcat = $_get['catid'];         $eventvenue =$_get['venuename1'];          $sqlsearch = " select * te_events                        catid = '$eventcat' , venueid = '$eventvenue'";           $rssearch = mysqli_query($conn,$sqlsearch) or die(mysqli_error($conn));       ?>     <!doctype html>     <html>     <head>     <title></title>     </head>     <body>          <thead>         <th>title</th>          </thead>     <?php     while ($row =mysqli_fetch_assoc($rssearch)){             //extract each field$             $id         = $row  ["eventid"];             $title      = $row  ["eventtitle"];             $desc       = $row  ["eventdescription"];             $venueid    = $row  ["venueid"];             // $venue       = $row  ["venuename"];             // $location   = $row  ["location"];             $categoryid = $row  ["catid"];             //$category   = $row  ["catdesc"];             $estart     = $row  ["eventstartdate"];             $eend       = $row  ["eventenddate"];             $eprice     = $row  ["eventprice"];            if(!empty($row)){         //start row             echo"<tr>\n";             //output url             echo"<td>\n";             echo"<div><a href =\"alldetails.php?eventid=$id\">                  $title</a></div>\n";             echo"</td>\n";         }             else{                 echo "no event found! please select other option.\n";            }          }         mysqli_free_result($rssearch);         mysqli_close($conn);      ?>      </body>     </html> 

check amount of rows , write code based on result.

$rows=mysqli_num_rows($rssearch);   if($rows > 0) {  while ($row = mysqli_fetch_assoc($rssearch)){  // code results  }   } else {  // legend no results  } 

edit: don't need ask mysql result array whether line populated or empty, line never empty, not exist in array if query didn't find data.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -