【发布时间】:2010-10-12 08:15:42
【问题描述】:
我想知道如何在下面的数组中搜索关键问题 ID 和等于我将提供的变量的值。然后,当它找到具有匹配键和变量的数组时,它也会输出该数组部分中的其他值。
例如,使用下面的示例数据。您如何建议我在数组中搜索所有具有键 issue_id 和值 3 的数组,然后让它输出键 issue_update_date 的值和键 issue_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
)
)
【问题讨论】:
标签: php arrays codeigniter multidimensional-array