[eluser]MercuryLime[/eluser]
I've searched around on this forum looking for help, but found no solution.
Basically, I am calling another function in my model code and I have identified that the specific line is breaking the code. I don't know why!
Here is the model (irrelevant functions removed).
Any ideas why that line is breaking the code?
Code:
<?php
class Challenges extends Model {
function Challenges()
{
parent::Model();
}
function get_challenge ($condition = array()) {
// Returns challenge object based on supplied conditions array (usually, single associative array with key 'id')
$query = get_where('challenges', $condition, 1, 0);
if($query->num_rows() == 1) {
return $query->row();
}
else {
return FALSE;
}
}
function get_current_challenge ($user_id) {
// returns object of the challenge table row (currently with keys 'id', 'title', 'decription', 'tags', 'date_created', 'submitter_id', 'approved')
// 1) Determine the challenge_ id of the current challenge of the user
// 2) Return the object of the challenge table row with that id
$this->db->select('challenge_id');
$query = $this->db->get_where('records', array('user_id' => $user_id, 'outcome' => 'ip'), 1, 0);
if($query->num_rows() > 0 ) {
$row = $query->row();
return $this->get_challenge(array('id' => $row->challenge_id));
// THIS LINE IS BREAKING THE CODE ^^^
}
else {
return FALSE; // User has no current challenge...? Deal with this.
}
}
}
?>
EDIT: *groan* Yes, it is possible to access different functions in the same method. I made a mistake using the Active Records get_where function.
Hours down the drain!