我想知道如何去搜索下面的數組中的關鍵problem_id和一個值等於我將提供的變量。然後,當它找到一個具有匹配鍵和變量的數組時,它也會在該數組的該部分中輸出其他值。搜索多維數組的值,然後在數組中輸出其他值
例如,使用下面的示例數據。你如何建議我搜索數組中所有具有關鍵problem_id和值3的數組,然後讓它輸出關鍵problem_update_date的值和關鍵problem_update_text的值。然後繼續搜索找到下一個出現?
在此先感謝,我一直在努力尋找答案,並相信我已超過我的頭!輸出的
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] =>
)
輸出的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
)
)
非常感謝這一點。對此,我真的非常感激。很快就會測試。我打破了MVC模式作爲解決我的問題的臨時解決方案,但是,這是我寧願攻擊它的方式。 – j10io 2010-10-12 12:09:18