Welcome Guest, Not a member yet? Register   Sign In
array index problem
#3

[eluser]JoostV[/eluser]
Sounds like your query is not returning results. Check with
Code:
echo 'numrows = ' . $query->num_rows();

To prevent errors from popping up, check if any rows were returned before processing.
Code:
// Query database for last sibling
$this->db->select('on_id');
$this->db->where('o_id', $o_id);
$this->db->where('on_pid', $on_pid);
$query = $this->db->get('outline_notes');

if ($query->num_rows() > 0) {
    $row = $query->last_row('array');
    $on_id = $row['on_id'];
    // Some more processing...
}
else {
    // No results were returned
    // Send a message to the user or do something else to handle error more gracefully
    echo 'Could not retrieve any records';
}

Also, if you wish to retrieve just one record, you might want to try adjust your SQL so that you can limit the result using $this->db->limit(1) for a more efficient query.


Messages In This Thread
array index problem - by El Forum - 12-17-2008, 12:23 PM
array index problem - by El Forum - 12-22-2008, 12:23 AM
array index problem - by El Forum - 12-22-2008, 04:19 PM
array index problem - by El Forum - 01-18-2009, 08:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB