[eluser]boltsabre[/eluser]
Well the way you have it set up currently is after your search queries, you're checking the result of $post_query before $post_query2
Code:
if ($post_query->num_rows() == 0) {
return array();
} else {
$i = 0;
foreach ($post_query->result() AS $row) {
$post_array[$i]["post_id"] = $row->post_id;
$post_array[$i]["post_message"] = $row->post_message;
$post_array[$i]["post_datetime"] = $row->post_datetime;
$post_array[$i]["post_completion_status"] = $row->post_completion_status;
$post_array[$i]["post_completion_date"] = $row->post_completion_date;
$post_array[$i]["post_completion_notes"] = $row->post_completion_notes;
}
return $post_array;
}
You're returning either return array(); if no results were found, or $post_array;. This code will NEVER check $post_query2 as you are returning something before you get to it.
I'm not 100% sure what you're trying to achieve, but you could try something like this perhaps...???
Code:
if ($post_query->num_rows() == 0) {
$return['post_q_1_empty'] = true;
$return['post_q_1_full'] = false;
} else {
$i = 0;
foreach ($post_query->result() AS $row) {
...;
}
$return['post_q_1_empty'] = false;
$return['post_q_1_full'] = $post_array;
}
if ($post_query2->num_rows() == 0) {
$return['post_q_2_empty'] = true;
$return['post_q_2_full'] = false;
} else {
$a = 0;
foreach ($post_query2->result() AS $row2) {
...
$a++;
}
$return['post_q_2_empty'] = false;
$return['post_q_2_full'] = $post_array2;
}
return $return
Basically you're just building your multiple return values into an array, and returning that array.
Hope that helps...???