Jump to content

mysql advanced sorting and CONDENSING of queries.


dj-kenpo

Recommended Posts

so I have a query that grabs the 10 latest updates to my site (it's a seperate table that tracks inserts)

as of now, you can see in the example output if I add 3 photos, it lists each,

 

I'd much prefer to to have the system say, Adam added 3 new photos... (only if they happen one after the other though with no breaks inbetween!)

 

but how would I do this? load the result into another array and then sort?

I'm having trouble wrapping my head around it.

 

here's the normal call

$sql_update_pings = "SELECT * FROM update_pings WHERE User_ID = $User_ID ORDER BY Timestamp DESC, ID DESC LIMIT 10";

$result_update_pings = mysql_query($sql_update_pings);

 

while ($row_update_pings = mysql_fetch_array($result_update_pings))

{

$update_pings_ID = $row_update_pings["ID"];

$update_pings_Title = $row_update_pings["Title"];

$update_pings_Mode = $row_update_pings["Mode"];

$update_pings_Parent = $row_update_pings["Parent"];

$update_pings_Timestamp = $row_update_pings["Timestamp"];

.......etc.......

 

result:

 

# Adam added a new journal entry entitled 'How to - Wireless hand crank mouse' - Wednesday, April 11

# Adam added a new journal entry entitled 'Ferrets hide things better than bunnies.' - Tuesday, April 3

# Adam added a new photo to 'Loki the ferret' - Tuesday, April 3

# Adam added a new journal entry entitled 'VNV Nation - Judgement' - Monday, April 2

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

# Adam added a new CV item 'Chicago Tribune "Bio-artists bridge the gaps between arts and sciences" March 8th 2007' - Friday, March 30

the actual query can be seen running at brandejs.ca/journal.php if it helps

 

cheers!

Link to comment
Share on other sites

# Adam added a new photo to 'Loki the ferret' - Tuesday, April 3

# Adam added a new journal entry entitled 'VNV Nation - Judgement' - Monday, April 2

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

# Adam added a new photo to 'Loki the ferret' - Friday, March 30

 

would be adam added 3 photos to ...

 

not 4 photos

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.