Reputation: 1911
I have the following PHP code in a class extending mysqli.
$queryString = 'SELECT ' . ID_UBICACION . ' FROM ' . TABLE_UBICACION_EVENTO . ' WHERE ' . ID_EVENTO . '=' . $id;
$queryResult = $this->query($queryString);
var_dump($queryResult);
while ( $row = $queryResult->fetch_assoc() ) { //This is line 1090!!!!!!
$queryString = 'DELETE FROM ' . TABLE_UBICACION . ' WHERE ' . ID_UBICACION . '=' . $row[ID_UBICACION];
$queryResult = $this->query($queryString);
}
The output shows:
object(mysqli_result)#36 (0) { }
Fatal error: Call to a member function fetch_assoc() on a non-object in /var/www/vhosts/davidcasillas.es/subdomains/aem/httpdocs/BaseDatos.php on line 1090
If $queryResult is a valid mysqli_result object, why do I get the error?
Upvotes: 0
Views: 890
Reputation: 43168
You are replacing the value of $queryResult
within your loop body. DELETE
queries do not return a valid result resource, they return only a boolean success flag.
Upvotes: 1