If the DB object wasn't created surly the $this->database->query() would error first :S
It seems that I was trying to call num_rows as a function rather than a property.\
public function add($id)
{
if ($this->items[$id] <= 0)
{
$this->items[$id] = 0;
}
if (ereg("([A-Z0-9]+)", $id))
{
if ($results = $this->database->query("SELECT * FROM `products` WHERE code='$id'"));
{
if ($results->num_rows == 1)
{
$this->items[$id]++;
$results->close();
return 1;
}
else
{
return $this->error;
}
}
}
else
{
return $this->error;
}
}
This seems to work now.
Anyone know what causes these errors:
Warning: Call to private basket::__destruct() from context '' during shutdown ignored in Unknown on line 0
Warning: Call to private database::__destruct() from context '' during shutdown ignored in Unknown on line 0