如何使用 PHP 和 MySQL 管理我的评论系统

How to Manage my Comment System in Using PHP and MySQL

拜托,我需要帮助。我正在设计一个使用 MySQl 数据库和 table 的网络应用程序,如上所示。我如何 select 来自评论 table 的评论并与成员 table 一起显示评论以及与 user_id 相对应的用户名,因此:

您的 sql 将是这样的:

$usercomment = $conn->query("select m.usename, c.comment
                            from member m
                            join comment c
                            on m.id = c.user_id");

你会像这样提取数据:

while ($row = $usercomment->fetch_assoc()) {
          echo $row['comment'].' by .'row['username'].<br/>';
}