advanced database query :p - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: advanced database query :p (/showthread.php?tid=28981) |
advanced database query :p - El Forum - 03-26-2010 [eluser]johansonevR[/eluser] hello, i am new to this forum as i am new to CI. However i am looking at the blog tutorial. well the problem is here i don't know how to explain it exactly but i will give it a try. i have a function: user clicks on a link and gets the data from view(). Code: function view(){ Code: $this->db->query("select * from adv where id='$id';"); advanced database query :p - El Forum - 03-26-2010 [eluser]theprodigy[/eluser] Quote:$this->db->query("select * from adv where id='$id';");What you are looking for is: Code: $this->db->where('id',$id); advanced database query :p - El Forum - 03-26-2010 [eluser]johansonevR[/eluser] tnx for the reply , however i still don't understand how to get the id from this : Code: anchor("adv/view/".$row->id, "View"); advanced database query :p - El Forum - 03-26-2010 [eluser]theprodigy[/eluser] Quote:function view(){ Quote:anchor("adv/view/".$row->id, "View"); I'm going to assume that this function is in a Controller called adv. What you need to do is give your view method a parameter, and use that parameter. Code: function view($id){ advanced database query :p - El Forum - 03-27-2010 [eluser]johansonevR[/eluser] tnx |