Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to write a select query in codeigniter?


Asked by Chaya Glover on Dec 01, 2021 FAQ



$this->db->where (); helps to write the where clause of the select query. There are multiple variations of this where () function in codeigniter and let's see them later in this tutorial. $this->db->get (); executes the select query and returns the resultset. Let's take this below mysql table as an example for writing select query in codeigniter.
Accordingly,
CodeIgniter Select Query with $this->db->select () The select () method allows you to write the “SELECT” portion of your query. This is how you can select records from ’employee_master’ table using $this->db->select () method.
Indeed, CodeIgniter Select Query with $this->db->like () The like () function allows you to generate “ LIKE” clauses for your query. You are free to use like () function multiple times to prepare your select query, they all will be chained together with AND between them.
Subsequently,
Codeigniter Select Query with Multiple Where Condition: You can apply multiple where conditions in a single select query. Below code igniter select query example uses multiple where clause combined with AND keyword.
Next,
While using raw queries we also have the query binding concept which we can use as a type of placeholder for the values. Query binding in CodeIgniter 4 includes the concept of placeholders for values and named binding. This tutorial will provide you the complete concept of running raw queries in codeigniter 4.