Part of the EllisLab Network
   
 
Database query with multiple tables
Posted: 03 July 2007 04:40 PM   [ Ignore ]  
Summer Student
Total Posts:  8
Joined  06-29-2007

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.

Profile
 
 
Posted: 03 July 2007 05:05 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  86
Joined  05-22-2007

This may help you, not 100% sure.

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

 Signature 

Thanks, CodyPChristian
I’m a web designer & developer please check out my portfolio

Personal Blog: CodyPChristian.net
Owner of CPC Designs CPCDesgins.com

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 64459 Total Logged-in Users: 19
Total Topics: 80971 Total Anonymous Users: 0
Total Replies: 435716 Total Guests: 165
Total Posts: 516687    
Members ( View Memberlist )