Welcome Guest, Not a member yet? Register   Sign In
[Resolved] Query returns results in phpMyAdmin but doesn't with ActiveRecord
#1

[eluser]kirkaracha[/eluser]
I have this query in my model:
Code:
public function get_person_office_info($person_office_id) {
    $this->db->select('
        people_offices.office_start_date,
        people_offices.office_end_date
    ');
    $this->db->where('id',$person_office_id);
    $this->db->limit('1');
    $results = $this->db->get('people_offices');
    return $results;
} // get_person_office_info

That doesn't any results, even though I know there are results from looking at the database.

$this->db->last_query()):
Code:
SELECT `people_offices`.`office_start_date`, `people_offices`.`office_end_date` FROM (`people_offices`) WHERE `id` = '53' LIMIT 1

When I copy that query into phpMyAdmin, it returns the expected results.

Here's how I'm calling it from the controller:
Code:
$person_office_id = $this->uri->segment(3,0);
$person_office_info = $this->People_model->get_person_office_info($person_office_id);

get_where doesn't work, either:
Code:
public function get_person_office_info($person_office_id) {
    $results = $this->db->get_where('people_offices', array('id' => $person_office_id),1,0);
    return $results;
} // get_person_office_info

Produces:
Code:
SELECT * FROM (`people_offices`) WHERE `id` = '53' LIMIT 1

Again, works in phpMyAdmin, doesn't work in CI.


Messages In This Thread
[Resolved] Query returns results in phpMyAdmin but doesn't with ActiveRecord - by El Forum - 01-24-2010, 11:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB