This is my first real bash at Code Igniter. I'm attempting to return the results of a mySql query to a table.
My model:
public function generate_ecomm_data_report(){
$sql = "SELECT
COUNT(*) AS no_skus,
pd_vendor AS brand,
(SELECTCOUNT(DISTINCT(pd_model_code))
FROM iris_product_data
WHERE pd_vendor = PD.pd_vendor ) AS unique_models
FROM iris_product_data PD
GROUP BY pd_vendor
ORDER BY
COUNT(*) DESC";
$query = $this->db->query($sql);
return $query->result();
}
My controller:
public function ecomma(){
$this->load->model('report_model');
$data ['query'] = $this->report_model->generate_ecomm_data_report();
$this->load->view('report_view', $data);
}
When loading the controller I get a 1064 error however. Can anyone see an issue here? (I've excluded the View, I don't believe there's an issue here).