I have a small project built from scratch and I want to convert it by using CodeIgniter. How can I convert this query string into activerecord? Sorry I am still new to CI.
SELECT c.*, p.*, cp.* FROM css c, php p, cplusplus cp WHERE cp.id = p.cp_id AND p.id = c.p_id
It is very is to write CI Active records. You can start learning here.
First configure the DB details then load
$this->load->database();
This is active record way of your query. Not exactly the same but response will same(optimized way)
$this->db->select("*")
->from("php")
->join("css", "css.pid = php.id")
->join("cplusplus", "cplusplus.cp_id = php.cp_id")
->get()->result_array(); //Returns multiple records
You can use ____->get()->row_array();
for single record.
** Response will be in array format.