title: MYSQL Results; no records found statement
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10326746/display-data-from-mysql-sql-statement-error">Display Data From MYSQL; SQL statement error</a>  </p>
  </blockquote>
  
  
  
  <p>I have the code below displaying data from a MYSQL database (currently looking into sql injection issue) I need to insert an error message when no results are found...not sure where to position this! I have tried the code if( mysql_num_rows($result) == 0) {
    echo "No row found!" but keep on gettin syntax errors, does anyone know the correct position in the code for this?</p>
  
  <p>--
       
  
  <pre><code> require 'defaults.php';
   require 'database.php';
  
   /* get properties from database */
  
   $property = $_GET['bedrooms'] ;
   $sleeps_min = $_GET['sleeps_min'] ;
   $availability = $_GET['availability'] ;
  
  
    $query = "SELECT * FROM `properties` WHERE bedrooms = '{$bedrooms}' AND sleeps_min = '{$sleeps_min}' AND availability = '{$availability}'";
    $row=mysql_query($query);
  
    $result = do_query("SELECT * FROM `properties` WHERE bedrooms = '{$bedrooms}' sleeps_min = '{$sleeps_min}' AND availability = '{$availability}'", $db_connection);
  
   while ($row = mysql_fetch_assoc($result))
   {
  $r[] = $row;
   }
  
   ?&gt;
  </code></pre>