Simple question i guess... need help using the db class! |
[eluser]Jason van der Zeeuw[/eluser]
hey all... I've got this function: Code: function get_employees($tablename) 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 :$?
[eluser]Matalina[/eluser]
if you want an array of results why don't you use: Code: $resultarray = $q->result_array();
[eluser]Jason van der Zeeuw[/eluser]
Wow nice one! thank you for helping me out with this one!!! it works I didn't knew that function...
[eluser]CroNiX[/eluser]
Also your original problem was because you used: Code: foreach ($q->result as $row) { Code: foreach ($q->result() as $row) { //result() is a method, not a property. |
Welcome Guest, Not a member yet? Register Sign In |