Welcome Guest, Not a member yet? Register   Sign In
Advanced MySQL: Active Record Query not working properly?
#1

[eluser]MercuryLime[/eluser]
Do you have an idea how to write:

Code:
$query = $this->db->query('SELECT c.title, c.description, r.completion_notes, r.outcome FROM challenges AS c, records AS r WHERE c.id = r.challenge_id AND r.user_id = ' . $user_id . ' AND r.outcome = "ip" LIMIT 100');

as an Active Record Query?

I tried the following, but it returned 0 results.

Code:
$this->db->select('c.title, c.description, r.completion_notes, r.outcome');
        $this->db->from('challenges AS c, records AS r');
        $this->db->where(array('r.challenge_id' => 'c.id', 'r.user_id' => $user_id, 'r.outcome' => 'ip'));
        $this->db->limit(100, 0);
        $query = $this->db->get();

Help would be appreciated!


Messages In This Thread
Advanced MySQL: Active Record Query not working properly? - by El Forum - 06-07-2008, 09:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB