Home>

php mysql Reply function The reply is displayed as a parent comment on the bulletin board.

I have saved it in SQL with the id of the parent comment, but I don't know how to bring the display under the parent comment.

<!-Reply function->
   <form action = "reply1.php" method = "post">
   <textarea name = "reply"></textarea>
   <input type = "hidden" name = "userid" value = "<? php echo $post ['User_ID'];?>">
   <input type = "hidden" name = "messageid" value = "<? php echo $post ['messageid'];?>">
   <input type = "submit" name = "send_reply" value = "reply">
   </form>


SQL

<!-reply1.php->
<? php
// Connect to database, create if there is no table
try {
  $pdo = new PDO (DSN, DB_USER, DB_PASS);
  $pdo->setAttribute (PDO :: ATTR_ERRMODE, PDO :: ERRMODE_EXCEPTION);
} catch (Exception $e) {
  echo $e->getMessage () .PHP_EOL;
}
//registration process
try {
    $stmt = $pdo->prepare ("insert into board.message (parentmessageid, bbsid, userid, message) values ​​(?,?,?,?)");
    $stmt->execute ([(int) $_POST ['messageid'], 1, (int) $_POST ['userid'], $_POST ['reply']]);
    echo'Reply complete';
  } catch (\ Exception $e) {
    echo $e;
    echo'Could not reply. ';
  }
?>

I looked it up on a bulletin board with a reply and took measures, but it didn't go away.
I'm sorry, but I'm really a beginner of self-study for a month. I would really appreciate it if you could tell me in an easy-to-understand manner.