title: Injecting an SQL to Controller in codeignitor
body: <p>I am trying to inject a SQL with a DATE_FORMAT method and it gives me parsing error. But the query working perfectly in phpmyadmin. Below you can find my code which is my controller</p>
  
  <pre><code>public function index() {
    $sql = "SELECT DATE_FORMAT('added_date', "%M") AS Month, SUM(total) FROM tbl_order GROUP BY DATE_FORMAT('added_date', "%M")";
    $query = $this-&gt;db-&gt;query($sql);
    $orderData= $query-&gt;result_array();
    $data["orderData"] = $orderData;
    var_dump($data);die;
    $this-&gt;load-&gt;view('admindashboard/index.php',$data);
  }
  </code></pre>
  
  <p>I have attached the error message as well<a href="https://i.stack.imgur.com/3J3d9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3J3d9.jpg" alt="enter image description here"></a></p>