CodeIgniter Forums
[SOLVED] to view a list using models - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: [SOLVED] to view a list using models (/thread-26487.html)



[SOLVED] to view a list using models - El Forum - 01-14-2010

[eluser]Unknown[/eluser]
Hello;
I got a program for library. and i had some models. one of them is "book". and it has "is_available" (boolean) field.
and i want to take a "available books list".
can you help me about this please?
if i want to view a specific book i do it like this:
$this->db->where("book_id", $this->input->post("book_id"));
$query = $this->db->get('book');


[SOLVED] to view a list using models - El Forum - 01-14-2010

[eluser]WebsiteDuck[/eluser]
Code:
$this->db->where("book_id", $this->input->post("book_id"));
$this->db->where("is_available", true);
$query = $this->db->get('book');

or if you want all available books get rid of the first line


[SOLVED] to view a list using models - El Forum - 01-14-2010

[eluser]Unknown[/eluser]
thnank you Smile