Please see the following query.
I want to convert it into codeIgniter active records.
SQL QUERY:
$this->db->query("SELECT SUM(A.votes) as reputation from
(
SELECT reply.votes FROM reply where reply.user_id = $user_id
UNION ALL
SELECT thread.votes FROM thread where thread.user_id = $user_id
)AS A");
How can I convert this without using $this->db->query()?
The ActiveRecord style of querying with CodeIgniter escapes parameters, but not db->query()
and also db->query()
is not SQL Injection protected by default.
That's why I want to convert it using codeigniter active records.
Thanks in advance.