Reputation: 2251
CodeIgniter 3 documentation , as well as in version 2, only mentions this kind of query bindings for building queries:
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'));
Does anyone know if any kind of named query bindings are available though not documented? I'm refering to something similar to
SELECT * FROM some_table WHERE id = :id AND status = :status
...I expected some kind of improvement at this particular point.
Upvotes: 0
Views: 381
Reputation: 38642
As i know this kind of query works with Symfony(as i know)
SELECT * FROM some_table WHERE id = :id AND status = :status
so when you come to Codeigniter you have to follow this
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'))
So query will be
SELECT * FROM some_table WHERE id = 3 AND status = 'live' AND author = 'Rick'
So first method is not work with Codeigniter.
Upvotes: 1