こんにちはみんな私はこれらのテーブルを持っています。
USERS( user_id ,fullname ,username etc.)
POSTS ( post_id, user_id, post, orig_post_id, replyto date)
USER_PROFILE (id, user_id, profile_image_path etc)
例
USERS (1 ,John Doe ,johndoe etc.),( 2 ,Stack Flow ,stackflow etc.)
POSTS (2, 1, My naame is John doe and i approve this message, 0, 0,sometimestamp),
(3, 12, My naame is Stack Flow and i approve this message, 0, 2,sometimestamp)
USER_PROFILE (1, 1, ppdjodjf.jpg etc),(2, 2, grsdjodjf.jpg etc)
基本的に、replytoフィールドが0の場合、クエリでこれを出力する必要があります
array('post_id' => 2,
'user_id' => 1,
'post' => the post,
'orig_post_id,' => 0
'replyto,' => 0
username => johndoe,
fullname => John Doe,
profile_image_path => etc)
そしてそれがゼロでないとき
array('post_id' => 3,
'user_id' => 2,
'post' => Another post,
'orig_post_id,' => 0
'replyto,' => 2
username => stackflow,
fullname => Stack Flow,
profile_image_path => etc,
'replies' => array(all the replies)