Hi Friend,
I see the problem you have asked is more toward an idea rather than any code so I also will only be giving you the idea to do so. No code will be provided by me on this context and its like your own job to do so also.
Here's the idea,
Like Button :
1. A Like button is a simple hyperlink
<a class="like_button" href="<?php echo $post_id; ?>">Like</a>
2. Whenever a click event occurs on any like button, you have to get it's href attribute using jQuery or javascript. Then, you will use AJAX to pass that value to a processor (a php file) which will be using database connection to update a column 'post_likes' WHERE 'post_id' is what you have posted to it.
3. Now when the processor successfully updates the database, it will return true which is used by the javascript to update the number of likes on the front end.
Now a Comment Box :
1. Again the concept is same just that this time, instead of an anchor tag, you will have an input type text and it will contain class and a name
<input type="text" name="<?php echo $post_id; ?>" class="comment_box" />
2. Now the whole concept is going to be same about on return key press "you can search internet for detecting a RETURN key press event detection in javascript or jQuery.
3. Now this time, you can store all the comments in form of a serialized array in a single column 'post_comment' in database's table 'posts'.
4. The steps are,
$result = mysql_query("SELECT post_comment FROM posts WHERE post_id = '$post_id'");
5. Unserialize the data received using the query operation. Before that, also check if the data is blank or not. Now you can append new comment like this
$array_comments[] = $_GET['comment_string'];
6. Now you have to serialize the updated array again and store it back to the database using update query.
7. Now, you are done, return a true. Now inside the javascript run a function to update the front end to display the newly posted comment.
Hope that this idea or walkthrough will help you achieve what you want to do. Please do mark it as solved and rate it.
With Regards
Tushar Srivastava