[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.