EllisLab text mark
Advanced Search
     
Database query with multiple tables
Posted: 03 July 2007 06:40 PM   [ Ignore ]
Joined: 2007-06-29
15 posts

Is there a way to convert this query that are using two tables by using the Active Record Class

$query $this->db->query('SELECT * FROM lkx_text, lkx_page WHERE lkx_page.pg_id = '.$pdid.' AND lkx_text.pg_id = lkx_page.pg_id'); 


for example this code

$query $this->db->query('SELECT * FROM table1 WHERE table1_id = '.$var_id); 

can be replaced with this

$this->db->where('table1_id'$var_id);
$query $this->db->get('table1'); 

where you don’t need to add the SELECT because it does it automatically. but how to do this with 2 tables.

I am newbie so have patient.

Thanks in advance for your help.

 
Posted: 03 July 2007 07:05 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-05-22
85 posts

This may help you, not 100% sure.

http://ellislab.com/forums/viewthread/55617/

 Signature 

Thanks, CodyPChristian

More about me here: CodyPChristian.net
Host of LearnCI - learn-codeigniter.com