Simple question i guess... need help using the db class! - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Simple question i guess... need help using the db class! (/showthread.php?tid=51419) |
Simple question i guess... need help using the db class! - El Forum - 05-03-2012 [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/codeigniter-from-scratch-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 :$? Simple question i guess... need help using the db class! - El Forum - 05-03-2012 [eluser]Matalina[/eluser] if you want an array of results why don't you use: Code: $resultarray = $q->result_array(); Simple question i guess... need help using the db class! - El Forum - 05-03-2012 [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... Simple question i guess... need help using the db class! - El Forum - 05-03-2012 [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. |