I want to execute a query but php/mysql throws
Call to a member function fetch_row() on a non-object
even though
if(!$results)
should filter out empty results. The error message points to
$row = $results->fetch_row();
This is the whole code:
<?php
$query = 'DELETE FROM `products` WHERE `company` ='.$id_nummer;
$results = $link->query($query);
if(!$results)
{
echo $link->error;
}
else
{
$row = $results->fetch_row();
$wanted_result = $row[0];
}
?>
Where is the cause for this?
EDIT: I solved it by replacing
if(!$results)
with
if(!is_object($results))
and it works.