Welcome Guest, Not a member yet? Register   Sign In
Query Problem (Multiple Tables)
#1

[eluser]ywftdg[/eluser]
Hey guys, stuck again on something. Im learning, newbie styles...

I have this setup:

Code:
$this->db->where('field_id_8', $this->uri->segment(1));
$data['queryB'] = $this->db->get('exp_weblog_data');
        
$sql = "SELECT * FROM exp_weblog_data, exp_weblog_titles WHERE exp_weblog_data.entry_id = exp_weblog_titles.entry_id";
$data['queryA'] = $this->db->query($sql);

My problem is, in the blank area, I am assuming I need to do some sort of join, in order for my second query to only be pulling results, based on the results of the first query. Basically, I want to get the first items base don the url. Then that data, actually determines what gets loaded in the next one, since they both contain entry_id. My problem right now is the second just starts all fresh, and grabs everything. I am pulling my hair out on this one...

Also, is there a way I could pass all the results into one nice $data value?
#2

[eluser]ywftdg[/eluser]
Wow, somehow answered this one my own, pulled this out my...

Code:
$this->db->where('field_id_8', $this->uri->segment(1));
$this->db->select('*');
$this->db->from('exp_weblog_data','exp_weblog_titles');
$this->db->join('exp_weblog_titles', 'exp_weblog_titles.entry_id = exp_weblog_data.entry_id');
$data['query']=$query = $this->db->get();




Theme © iAndrew 2016 - Forum software by © MyBB