Hi all,
I'm wondering how I might go about searching the array below for the key problem_id and a value equal to a variable which I would provide. Then, when it finds an array with a the matching key and variable, it outputs the other values in that part of the array too.
For example, using the sample data below. How would you recommend that I search the array for all the arrays that have the key problem_id and the value 3 and then have it output the value of the key problem_update_date and the value of the key problem_update_text. Then keep searching to find the next occurrence?
Thanks in advance, I've been searching really hard for the answer and believe i'm over my head!
Output of print_r($updates);
CI_DB_mysql_result Object
(
[conn_id] => Resource id #30
[result_id] => Resource id #35
[result_array] => Array()
[result_object] => Array()
[current_row] => 0
[num_rows] => 5
[row_data] =>
)
Output of print_r($updates->result_array());
Array
(
[0] => Array
(
[problem_update_id] => 1
[problem_id] => 3
[problem_update_date] => 2010-10-01
[problem_update_text] => Some details about a paricular issue
[problem_update_active] => 1
)
[1] => Array
(
[problem_update_id] => 4
[problem_id] => 3
[problem_update_date] => 2010-10-01
[problem_update_text] => Another update about the problem with an ID of 3
[problem_update_active] => 1
)
[2] => Array
(
[problem_update_id] => 5
[problem_id] => 4
[problem_update_date] => 2010-10-12
[problem_update_text] => An update about the problem with an ID of four
[problem_update_active] => 1
)
[3] => Array
(
[problem_update_id] => 6
[problem_id] => 4
[problem_update_date] => 2010-10-12
[problem_update_text] => An update about the problem with an ID of 6
[problem_update_active] => 1
)
[4] => Array
(
[problem_update_id] => 7
[problem_id] => 3
[problem_update_date] => 2010-10-12
[problem_update_text] => Some new update about the problem with the ID of 3
[problem_update_active] => 1
)
)