Results 1 to 8 of 8
May 18, 2009, 11:08 #1
- Join Date
- Jul 2005
- 0 Post(s)
- 0 Thread(s)
Help - Math for an ID Range in a MySQL Query
I'm making an activity feed for user uploaded pictures and since I want the feed to only display their new images and only one entry, I want it to pull thumbnails for a range based on the id of their newest photo.
So, essentially, if their ID on the newest picture is 10 and they uploaded five photos, and I wanted to show 5 as a range I'd want the query to backstep and pull id #'s 10 thru 5.
I have already pulled the ID of their most recent public picture and made it $id.
Here is my query that will get the array data for the thumbs. I need help with scripting the math part of it to pull WHERE id = (a range of $id - 5)
$result2775=mysql_query("SELECT url FROM imagetable WHERE name = '" . $active['name'] . "' && id = () ORDER BY id DESC LIMIT 0,5");
Thanks, I hope its possible and that I wasn't too unclear about what I'm trying to accomplish. I've tried a number of things but none yielded favorable results.