[eluser]sore eyes[/eluser]
hi, I want to pull the first record from a database. I am using select_min() to do this.
For the model:
Code:
function getMinShopID()
{
$this->db->select_min('shop_id');
$data = $this->db->get('shop');
return $data;
}
For the controller:
Code:
function getFirstRecord()
{
$shop_id = $this->MShops->getMinShopID();
echo "shop id is ".$shop_id;
}
Produces an error:
A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysql_result could not be converted to string
Filename: controllers/welcome.php
Line Number: 63
shop id is
Any ideas please and a merry xmas