Welcome Guest, Not a member yet? Register   Sign In
Get image url from model good practice?
#7

I don't understand what you mean

in your example you have a Model which uses exactly the foreach approach


Quote:foreach($result->result() as $single) {...


and if you have a function where you know exactly that you expect only one result
than you can write something like 

PHP Code:
$result $this->db->get();
if (
$result->num_rows() == 1)
{
    
$objProduct $query->row(0"Product_Object");
    return 
$objProduct;
}
return 
false
Reply


Messages In This Thread
RE: Get image url from model good practice? - by sintakonte - 11-10-2015, 06:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB