Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user_id = 1;
- // connect to database
- $db = mysqli_connect("localhost", "root", "", "comment-reply-system");
- // get post with id 1 from database
- $post_query_result = mysqli_query($db, "SELECT * FROM posts WHERE id=1");
- $post = mysqli_fetch_assoc($post_query_result);
- // Get all comments from database
- $comments_query_result = mysqli_query($db, "SELECT * FROM comments WHERE post_id=" . $post['id'] . " ORDER BY created_at DESC");
- $comments = mysqli_fetch_all($comments_query_result, MYSQ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement