The following is written in codeigniter manual .
$ this-> db-> select () takes an optional second parameter. If you set this to FALSE, CodeIgniter will not try to protect the names of fields or tables with backticks. This is useful if you need a compound select statement.
$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4) AS amount_paid', FALSE); $query = $this->db->get('mytable'); ...
And I have the following code from one of the CI applications .
$this->db->select('slug, type, IF(`value` = "", `default`, `value`) as `value`', FALSE);
Q1. What are the differences between reverse and single quote?
Q2. Is it possible to use an IF statement in a query as described above?
Q3. What does it mean?
IF(`value` = "", `default`, `value`) as `value`
source share