Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14114

How to make this query a little bit more readable?

$
0
0
PHP Code:
        $fname_format "CONCAT(b.last_name, ', ', b.first_name, ' ', b.middle_name) AS full_name";
        
$this->db->select("a.id, b.id AS employee_id, {$fname_format}, c.id AS machine_id, c.title AS machine, d.title AS hstatus, a.created_on, a.action_on, a.edit_on, a.problems_encountered, a.corrective_action,a.root_caused,a.remarks,a.item_replaced");
        
$this->db->from("reports AS a");
        
$this->db->join("employees AS b""b.id = a.employee_id");
        
$this->db->join("machines AS c""c.id = a.machine_id");
        
$this->db->join("hstatus AS d""d.id = a.hstatus_id");
        return 
this->db->get()->result_array(); 

Look at the select part, it's so ugly...

Viewing all articles
Browse latest Browse all 14114


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>