I would like to order my posts by their timestamp but that doesn’t and I don’t know why.
When I execute my query without order, it works, but when I add ORDER BY it doesn’t work.
This is my query :
SELECT * FROM Posts INNER JOIN Topics ON idTopic = idTopics
INNER JOIN Users ON idUserPosts = idUsers
WHERE idTopic = :idTopic LIMIT :limit_down, :limit_up
ORDER BY Posts.datePosts DESC;
Why that doesn’t work?
Try inversing the ORDER BY/LIMIT:
The order by needs to be before the limit, else the limit is way less useful: you’d get the X first rows of the table, but “first” using what criteria? And then you’d order those results.
You can do that, too, if you really want to, but think about what you are doing then: