![]() |
single ds with MVC? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: single ds with MVC? (/showthread.php?tid=2810) |
single ds with MVC? - El Forum - 08-25-2007 [eluser]Matthew90[/eluser] Hello, today I have started to work with CI and my first impression is really good :-) As this is my first job with a framework, the MVC-Model and strict OOP-Programming is new for me. Now I have an problem with the MVC-Model. It concerns the following... I want to return a single data set... without oop no problem: Code: $this->db->where(array('id' => $this->uri->segment(3))); I tried a lot of iddeas but without a result... At the moment my code is as followed: project_model.php Code: function get_requested_project($where) admin.php Code: function insert_project() I hope you know what I mean in spite of my bad English and I look forward to get an answer ;-) Greetings Matthew single ds with MVC? - El Forum - 08-28-2007 [eluser]Matthew90[/eluser] Does nobody have an idea? single ds with MVC? - El Forum - 08-28-2007 [eluser]obiron2[/eluser] if you replace Code: return $query->row(); with Code: return $query->result(); You will get an object back which is an array of objects, each one being a row of data. if you have returned the object to $resultSet you can then manipulate it by using the array offset and the row field names Code: print $resultSet[3]->fieldname; or Code: foreach ($resultSet as $resultRow) you can even take each resultRow and convert that to a Key->Value array Code: foreach ($resultRow as $resultKey => $resultValue) single ds with MVC? - El Forum - 08-28-2007 [eluser]Matthew90[/eluser] thx for your help obiron2, now it works fine :lol: |