need help in recent comment

Started on the old forum in April 2012 · view the original in the archive · old links redirect here

24 replies · 1,144 views · started 14 years ago · 1 min read

5 participants
asifnayem Developer · 119 posts #21

something else wrote: try this: .... if it doesnt work let us know the error

$result = mysql_query("SELECT MAX(id) AS id, bid  FROM comment GROUP BY bid ORDER BY id desc LIMIT 10") OR die(mysql_error());

you may need to add a few more row name above ^

It has no error but the same old thing, showing the first comment of the posts not the last one. i think there should be two order by system. 🙁

something else Fellow · 2,296 posts #23

yeah it need a sub query .... i will set up a table on my database and work it out when im more awake .... had very little sleep past few days 😛

something else Fellow · 2,296 posts #24
$result = mysql_query("SELECT a.* FROM comment a INNER JOIN (SELECT MAX(id) AS id FROM comment GROUP BY bid) b ON a.id = b.id LIMIT 10");

Tested and working 🙂

asifnayem Developer · 119 posts #25

thanks :* it works. also i added order by id desc before the limit word.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close