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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.