How do social network like facebook display different content, such as photos, status, user activities onto the page, in the order it was originally posted. I have done a lot research but can’t seem to find any good examples on how it’s done using PHP and MYSQL.
I have include a visual example of what i mean.

I think what you mean is that the different contents are in separate tables like photos, status updates, newconnections etc. And you want the final wall to pull data from all these tables into a single wall in the same chronological order of time. So, what I will suggest is to create a new table for the wall with the following main fields :
Activity_identifier,activity_idandtimestamp. HereActivity_identifieris the predefined identity of the activity such as sharing a photo (lets say 1), posting on the wall (lets say 2) etc andtimestampis the time when that activity was recorded by the user, andactivity_idis the id of that activity in the corresponding table.Everytime a new activity is created by the user, while populating the corresponding table for that activity, also record a corresponding entry in this table for wall.
Now your final query to create the wall will just have to call this new table for wall with
ORDER BY TIMESTAMP DESC, then the resulting data needs to be joined with other activity tables (useActivity_identifierintelligently here) through the foreign-keyactivity_idto recreate the wall in the exact chronological order that the user created them.For incremental call to the wall, maintain a timestamp of last query (lets say xtime) and every call do
timestamp > xtime ... ORDER BY TIMESTAMP DESC.Hope this helps!