butterface butterface - 1 month ago 7
PHP Question

I cannot get any results to display with this code

I get "Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given" when I use this code:

$sql = "SELECT name, time, age FROM friends WHERE age = " .$age. "limit 0, 10";

$secquery = mysqli_query($conn, $sql);

if (mysqli_num_rows($secquery) > 0){

while($row = $secquery->fetch_assoc()) {
echo "This person === ".$row['name']. " matched your age, which is " .$row['age']. '<br>';


I'm trying to match records in my db with the entered record. I've tried everything. A little help?

$sql = "SELECT name, time, age FROM friends WHERE age='$age' limit 10";