I have this table for insert comments data:(comments)
|id|message|timestamp|approved|parent_id|name|email|
and this table for insert reviews for comments:(reviews)
|id|cid|review_field1|review_field2|review_field3|...
php function :
function _comments_($id,$type){
$DB = mySqli::f("SELECT id,name,email,message,timestamp,review_field_1,review_field_2,review_field_3 FROM " . NEWS_COMMENTS . " LEFT JOIN " . NEWS_REVIEWS . " ON " . NEWS_COMMENTS . ".id = " . NEWS_REVIEWS . ".cid WHERE
pid = ? AND type = ? AND approved = 1 ORDER BY timestamp DESC LIMIT 12", $id, $type);
foreach($DB as $row){
$commentdata[] = $row;
}
return $commentdata;
}
for result:
<?PHP
$comments_list = _comments_('125','news');
foreach($comments_list as $row):
?>
/// HTML tags
<?PHP
$endforeach;
?>
This worked for me and show list of comments and reviews for each comments.
Now i need to show threaded comments(parent
) for each comment.
how do can i show threaded comments ?!
NOTE: for parent comment i dont send reviews.