Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7912875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:42:44+00:00 2026-06-03T13:42:44+00:00

I am planning to build a facebook like wall post system in my site.

  • 0

I am planning to build a facebook like wall post system in my site. I am working on codeigniter mysql and jQuery.

Now here is my question: I am loading all posts once user come to home page. I created 2 more tables that is comments and like for like and comments of the posts.

If I am loading all posts using jQuery and json, how will I load all likes and comments of that particular post?

Here is my code:

Model

function load_all_activities()
    {
    $this->db->select('*')->from('activity_board');
    $this->db->order_by("created_time", "desc");
    $this->db->limit(20);
    $this->db->join('profile', 'profile.user_id = activity_board.user_id');
    $query = $this->db->get();

    $data=array();
     foreach ($query->result() as $row){     
     $row->createdtime=$this->timeago($row->created_time);
    // $row->age=$this->birthday($row->birthday);
     $data[]=$row;
     }

    return $data;
    //return $query->result(); 
    }

Controller:

function load_activities(){

    $data=$this->users->load_all_activities();


    echo json_encode($data);

    }

View:

//Jquery load activities posts
function load_activities(){

$.post("<?=base_url()?>home/load_activities", function(data){   

$(data).each(function(index, item) {
    $(item).each(function(index, value) {    
    $("#wallposts").append('<div id="postContainer"> <div id="postPic"><a href=""><img src="'+value.picture_thumb+'"/></a></div> <div id="postMsg"><a href="#"><b>'+value.first_name +'</b></a>&nbsp;' +  value.message+'<br/><br/><a href="#">Like</a> &middot; <a href="#">Comment</a> &middot; '+value.createdtime+'<div id="deleteMsg">X</div> </div></div>');
    });
 });




},"json");  

}

Here is my mysql tables

CREATE TABLE `activity_board` (
 `activity_id` int(11) NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL,
 `message` text NOT NULL,
 `created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
 PRIMARY KEY (`activity_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;




CREATE TABLE `activity_comments` (
`comment_id` int(11) NOT NULL AUTO_INCREMENT,
 `comment` text NOT NULL,
 `avtivity_id` int(11) NOT NULL,
 `user_id` int(11) NOT NULL,
 `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
 PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:42:44+00:00Added an answer on June 3, 2026 at 1:42 pm

    If you’re going to build the html using js, you should consider using something like backbone.js or batman.js, these will allow you to build up templates and work in a more controlled manner. they’re client-side MVC js frameworks that will provide a lot of power..

    my two cents.. otherwise, i would prepend all the id’s with the post id

    eg.

    post_id:20

    <div class="postContainer" id="20">
      <table class="message" id="message_20></table>
      <table class="likes" id="likes_20></table>
      <table class="comments" id="comments_20></table>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im planning to build a Embedded system which is almost like an organizer i.e.
I am planning to build a University Management System using PHP/MYSQL. Should I get
I'm planning to build a CMS in PHP and MySQL, mainly for my own
I am planning to build a cassandra store system and also I need a
I am planning to build a system to broadcast public events (trials, meetings, conferences).
I am planning to build a training site which will accommodate multiple users. It
I'm planning to build an automated system for deploying an Android build to various
I need to have two separate pages on the site I'm planning to build
I am planning to build a RIA about a year from now (when my
I am planning to build a site with openID authentication , most of my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.