Welcome Guest, Not a member yet? Register   Sign In
Using select_min()
#1

[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


Messages In This Thread
Using select_min() - by El Forum - 12-24-2008, 05:16 PM
Using select_min() - by El Forum - 12-24-2008, 06:45 PM
Using select_min() - by El Forum - 12-24-2008, 07:13 PM



Theme © iAndrew 2016 - Forum software by © MyBB