我正在尝试从两个表格中选择数据
然后将其作为数组发送回功能
并使用codeigniter将该数据数组传递给我的视图。
当我在视图中print_r
Array
(
[0] => stdClass Object
(
[task] => Receiving Building Permit
[task_status] => 0
[date_duration] => 25.08.08 (1 day)
[gallery] => 1
[download] => 1
[project_name] => Investment and Development
)
[1] => stdClass Object
(
[task] => Back Filling
[task_status] => 1
[date_duration] => 16.11.08 - 21.11.08 (7 days)
[gallery] => 1
[download] => 1
[project_name] =>
Investment and Development
)
)
实际上它返回两行。
如果您注意到两行中project_name的值相同,则为
现在我想在行顶部打印project_name
值,然后我将用foreach重复行。
如何在foreach之前获得project_name
值?
答案 0 :(得分:3)
要打印项目名称,您可以$array[0]->project_name
。