[eluser]sn4k3[/eluser]
Quote:Fatal error: Call to a member function num_rows() on a non-object in D:\wamp\www\licitar\system\application\models\Auction_model.php on line 51
Code:
function BidAuction($id)
{
if(!$id)return false;
$fp = fopen("test.txt", 'w');
fwrite($fp, "asdsads");
// Check existence and if closed
$this->db->select('active, closed, currentprice');
$this->db->join('products', 'products.id = auctions.productid');
fwrite($fp, "sss");
$query = $this->db->get_where('auctions', array('id' => $id), 1);
if ($query->num_rows() == 0)
{
$query->free_result();
return false;
}
$row = $query->row_array();
$query->free_result();
fwrite($fp, serialize($row));
if($row['active'] == 0 || $row['closed'] == 1) return NULL;
$this->_BidAuction($id, $row['currentprice'], $_SESSION['userid'], $_SESSION['username']);
$_SESSION['bids']--;
fclose($fp);
return $row;
}
if i take off "$this->db->join('products', 'products.id = auctions.productid');" it works, but i realy need join tables
i use "$this->db->join('products', 'products.id = auctions.productid');" in other functions and it work well, by do:
Code:
$this->db->limit(1);
if($joinProduct)
$this->db->join('products', 'products.id = auctions.productid');
$query = $this->db->get_where('auctions', array('id' => $id));
Thanks