Jump to content

[SOLVED] Need some help retrieving data from tables...


CSmith1128

Recommended Posts

Hey..

 

I need some help..

I have a database with a few tables in it.

1 table is for images, another table is for comments, another table is for friends, and another table is for announcements.

 

The friends table has a unique_id, friend_id and user_id.

Every other table has a unique_id, user_id, add_date, and add_time.

 

I need to go through the friends list table, and for every entry in the table that contains a certain user_id, I need to get the most recent entries from the other tables that contain the friend_id associated with the user_id in the friends table.

 

So, for all my friends, I want to display the most recently uploaded images, comments, and announcements. I don't want to show the most recent from EVERY user, just the top 50 recent entries. So the top 50 out of everyone.

 

I want a total of the 50 most recent entries so I can display them on a users home page.

 

I have no idea how I would get started with this.

 

I'm using php, and I was thinking about putting them all in an array and then sort them all by the date and time, but I dont think it would be very efficient.

 

Can anyone help me get started or show me where to look for some ideas?

 

 

Thanks

Link to comment
Share on other sites

So, for all my friends, I want to display the most recently uploaded images, comments, and announcements. I don't want to show the most recent from EVERY user, just the top 50 recent entries. So the top 50 out of everyone.

And why can't you use an ORDER BY / LIMIT?

Link to comment
Share on other sites

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.