Welcome Guest, Not a member yet? Register   Sign In
How would i implement this SQL query in active record?
#1

[eluser]zulubanslee[/eluser]
Code:
SELECT title, firstname, lastname
FROM titles as t, authors as a, authortitle as at
WHERE (t.title LIKE '%newton%')
AND ((at.title_id_fk = t.id )
AND (a.id = at.author_id_fk))

I'm asking because as I understand it, if you use Active Record you don't have to use prepared statements. Can I implement the query above with prepared statements in CI?
#2

[eluser]JHackamack[/eluser]
would this be possible:
Code:
$this->db->select('title');
$this->db->select('firstname');
$this->db->select('lastname');
$this->db->like('t.title','newton');
$this->db->join('authortitle as at','at.title_id_fk = t.id');
$this->db->join('authors as a','a.id = at.author_id_fk');
$this->db->get('titles as t');
#3

[eluser]zulubanslee[/eluser]
Ill give it a shot.




Theme © iAndrew 2016 - Forum software by © MyBB