I know that the above message occurs becomes of wrong MySQL query, but what's wrong with my MySQL query here in this code? I did a lot of research to find it, but couldn't find the resolution. Table name: pic_msg Columns: image_path, ip, index(auto_increment)
<?php
$con = mysqli_connect("localhost","root","password","my_database");
// Check connection
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
?>
<?php
$test_ip = "test-ip";
$sql = "SELECT image_path FROM pic_msg  WHERE ip = '$test_ip' ORDER BY index DESC LIMIIT 1";
$result = mysqli_query($con, $sql);
$rowcount = mysqli_num_rows($result);
if ($rowcount > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {
        echo $row["image_path"]."<br>";
    }
} else {
}
mysqli_close($con);
?>
 
     
    