Could someone help me to correct this code?
I keep getting this error:-
Notice: Trying to get property 'num_rows' of non-object
<?php
  $test = $_GET['param'];
  $sql =" SELECT * FROM img WHERE id = $test ";
  $result = $conn->query($sql);
  if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
      echo " <div class='col-lg-9'> ";
      echo " <div class=card mt-4> ";
      echo " <img src=http://placehold.it/900x400 class=img-responsive alt=Responsive image> ";
      echo " <div class='card-body'> ";
      echo " <a class=pull-right> <button type=button class='btn btn-primary'>Prezzo " .$row["prz"]. " €</button> </a> ";
      echo " <h3 class=card-title>" .$row["nome"]. "</h3> "  ;
      echo "<br>";
      echo "<br>";
      echo " <p class=card-text>" .$row["ldscr"]. "</p> ";
      echo "</div>";
      echo "</div>";
      echo "<br>";
    }
  } 
?>
 
     
     
     
    