Welcome Guest, Not a member yet? Register   Sign In
Simple question i guess... need help using the db class!
#1

[eluser]Jason van der Zeeuw[/eluser]
hey all...

I've got this function:

Code:
function get_employees($tablename)
    {
        $result = $this->db->query("Select firstname from {$tablename}");
        if($result->num_rows() > 0)
        {
            foreach ($q->result as $row) {
                $resultarray[] = $row;
            }
            return $resultarray;
        }
        else
        {
            return false;
        }
    }

I have the database class loaded automatically in:
Code:
$autoload['libraries'] = array('database');

I did this after seeing this tutorial:
http://net.tutsplus.com/articles/news/co...tch-day-2/

but still I get some errors:

Message: Undefined property: CI_DB_mysql_result::$result
Message: Invalid argument supplied for foreach()
Message: Undefined variable: resultarray

While I do exactly the same as in the tutorial...

please can anyone help me :$?


Messages In This Thread
Simple question i guess... need help using the db class! - by El Forum - 05-03-2012, 05:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB