首先抱歉,如果问题不好,我的英语不太好。
我有以下查询
SELECT
*
FROM
`stream_post`
LEFT JOIN `stream_comment`
ON (`stream_post`.`stream_id` = `stream_comment`.`comment_stream_id`)
JOIN `users_metadata`
ON (`stream_post`.`user_id` = `users_metadata`.`user_id`)
ORDER BY
`stream_id` DESC
LIMIT 10
问题实际上是我想在同一页面上使用这些评论
所以它看起来像这样
parrent post 1
children comment 1
children comment 1
parrent post 2
children2 comment 1
children2 comment 1
我也将帖子 ID(流 ID 是什么)保存在评论表中并加入它们。
但是当我得到结果时,看起来像这样
Array
(
[stream_id] => 1
[user_id] => 1
[stream_text] => dasdadada
[date] => 1346400535
[comment_id] => 1
[comment_stream_id] => 1
[comment_user_id] => 1
[comment_text] => comment one
[posted] => 0
[full_name] => Henry Marg
[gender] => 1
[location] => Los Angeles
[birth_year] => 2012
[birth_month] => 1
[birth_day] => 1
[work_location] => Tesco
[about] => Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
)
Array
(
[stream_id] => 1
[user_id] => 1
[stream_text] => dasdadada
[date] => 1346400535
[comment_id] => 1
[comment_stream_id] => 1
[comment_user_id] => 1
[comment_text] => comment 2
[posted] => 0
[full_name] => Henry Marg
[gender] => 1
[location] => Los Angeles
[birth_year] => 2012
[birth_month] => 1
[birth_day] => 1
[work_location] => Tesco
[about] => Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
)
所以问题是当我遇到这些时,我得到的评论是分开的,还是合并的?
所以我想看起来像这样
一个
rray
(
[stream_id] => 1
[user_id] => 1
[stream_text] => dasdadada
[date] => 1346400535
[comment_id] => 1
[comment_stream_id] => 1
[comment_user_id] => 1
[comment_text] => comment one
[comment_text] => comment two
[posted] => 0
[full_name] => Henry Marg
[gender] => 1
[location] => Los Angeles
[birth_year] => 2012
[birth_month] => 1
[birth_day] => 1
[work_location] => Tesco
[about] => Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
)
有没有办法做到这一点?请有人给我一个提示或一个例子吗?
真的会很开心