[eluser]Unknown[/eluser]
Hello all,
I am struggling on this. Is it possible (and how) to have an if else statement within the use of active records.
My active record:
Code:
$q = $this->db
->select('*')
->where('this_column', 'that')
->where('that_column', 'other')
->get('projects');
if($q->num_rows > 0){
return $q->result();
}else{
return false;
}
So is it possible and how to have an if else statement like:
Code:
$q = $this->db
->select('*')
->where('this_column', 'that')
->where('that_column', 'other');
if($statement){
$q ->like('another_column', '%blah%');
}
}
$q->get('projects');
if($q->num_rows > 0){
return $q->result();
}else{
return false;
}
I have tried this, but returns a notice error 'Message: Undefined property: CI_DB_mysql_driver::$num_rows'
Who can help me with this?
greetz,
walter