Some time we need implement custom mysql queries in CakePHP. If you are looking to implement custom mysql query in cake php please follow the below example:
// Define your query and replace this with query written below
$query = $this->db->query("Select * from users");
// Check number of records return by this query
if($query->num_rows() > 0){
$data = $query->result_array(); // you will all the results under $data variable
print_r($data);
}
0 Comment(s)