Q:

How can I store the resulting MySQL rows into an array?

I have two functions. They both are very similar in that the one not shown uses a > instead of a < in the last time check:
<?php
function getOldEvents(){
    $con = db::conn();
    $result = mysqli_query($con, "SELECT * FROM events WHERE CAST(deleteEvent AS UNSIGNED INTEGER) > ".time()." AND CAST(end AS UNSIGNED INTEGER) < ".time());
    $i = 0;
    $theEvents = array();
    if (mysqli_num_rows($result > 0)) {
        while($row = mysqli_fetch_assoc($result)) {
            $theEvents[$i] = $row;
            $i++;
        }
    }
    mysqli_close();
    return $theEvents;
}
?>

Regardless of how many times I look at this, I think it should work, but I get an empty array when I check the output with print_r(getOldEvents()). I already know the SQL is valid, as I tested in it phpMyAdmin to be sure, and the results are as expected. I am just unable to retrieve the data properly from the $result variable. I'll also add that no errors appear on the page or in the log. Any help would be appreciated.

A:

You have a typo:
if (mysqli_num_rows($result > 0)) {

Should be:
if (mysqli_num_rows($result) > 0) {

