CodeIgniter Forums

Full Version: [SOLVED] to view a list using models
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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');

El Forum

[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

El Forum

[eluser]Unknown[/eluser]
thnank you Smile