Q:

Running if database row number is less than 10

I'm trying to make a function work only if the number in the row 'click' in my datbase is less than 10. This is what I have right now: I put the echo in there just to see if the condition is working or not.
<?php
include'connect.php';

$result = mysqli_query($con,"SELECT id, link_name, click  FROM clicks");

while($row = mysqli_fetch_array($result))
{
if ($row['click'] < 10) {
    echo $row['id'] . " " . $row['link_name']. " " .$row['click'];
echo "<br>";
}
}

mysqli_close($con);
?>

A:

try;
    

$result = mysqli_query($con,"SELECT id, link_name, click  FROM clicks WHERE click<10");

while($row = mysqli_fetch_array($result))
{
    echo $row['id'] . " " . $row['link_name']. " " .$row['click'];
    echo "<br>";
}

mysqli_close($con);
?>

