Jump to content

Recommended Posts

I was wondering what approach you would take to code a news feed like Facebook has.

 

I have a status, users,  and photo mysql tables. Would you create a new table called "feed" and have a query run everytime someone updates, inserts, etc anything in those three tables? or something else?

What would be the most efficient way to code a news feed?

 

Thanks in advanced!

Link to comment
https://forums.phpfreaks.com/topic/232084-like-facebook-news-feed/
Share on other sites

I was wondering what approach you would take to code a news feed like Facebook has.

 

I have a status, users,  and photo mysql tables. Would you create a new table called "feed" and have a query run everytime someone updates, inserts, etc anything in those three tables? or something else?

What would be the most efficient way to code a news feed?

 

Thanks in advanced!

 

I think you've answered your own question in your question lol.

 

You could use a query when a user updates a status, inserts, etc.

 

You could code the news feed in PHP but to allow auto refreshing:

You could also use some AJAX to auto refresh user pages  :P

Problems with this thread:

 

1) you bumped it twice in one day -- nearly once per hour since you posted

2) no code whatsoever -- this is a board for php coding help. Which implies you have existing code that you need help with.

 

Please take the time to read our Rules and Terms of Service.

Well thanks you for the reply, kadeous.

 

and no you're right, tomfmason, I don't have any code..... yet :P oh and I only bumped it once btw.

 

Do you think using JOIN would work for combining the three tables? I am no good at JOINs... I looked at some tutorials but still a little confusing.

So I think JOIN would do better because I dont want to select three different tables in three different querys and then fetch them in an array. If I did that things wouldn't be organized by date, it would be organized  by what query got fetched first.. correct?

and no you're right, tomfmason, I don't have any code..... yet :P oh and I only bumped it once btw.

You bumped twice.

 

Do you think using JOIN would work for combining the three tables? I am no good at JOINs... I looked at some tutorials but still a little confusing.  So I think JOIN would do better because I dont want to select three different tables in three different querys and then fetch them in an array. If I did that things wouldn't be organized by date, it would be organized  by what query got fetched first.. correct?

Correct, you would want to use a join.  Google some examples and give it a shot.

I did? huh okay...

 

Hmmm I just went over it all in my head again... would I want to structure it like that you think? Or as I said before just anytime someone posts or updates content it gets inserted into a table called "feed" then I could select all of it from there.. I think thats a better idea, what do you think?

 

Sorry if I am just babbling along.. just trying to organize my thoughts, the adderall is wearing off lol

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.