Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result [duplicate]

Your query must have a problem which is causing $result to be an invalid resource.

Try checking for mysql_error() after the line on which you run your query.

Edit:

In fact, I would alter your DBConnector class function query() to something like the following, so that an identifiable error is thrown when you have a bad query:

function query($query) {
    $this->theQuery = $query;
    $queryId = mysql_query($query,$this->link);
    if (! $queryId) {
        throw new Exception(mysql_error().".  Query was:\n\n".$query."\n\nError number: ".mysql_errno();
    }
    return $queryId;
}

Leave a Comment