Hello. I seem to have an issue where adding an ORDER BY
clause with a WHERE
clause removes everything completely and I get nothing. I am confused since I am using a statement:
SELECT * FROM forum_answer WHERE question_id='".$id."'"
and then it orders everything descending by default. Example is shown below.
I want instead for the answers to the forum (yes, I created an entire forum system from scratch instead of using a pre-made one) to order ASCENDING instead of DESCENDING, in this case the newest answers shown first instead of last. I have it so that my code inserts a new row into the database, and then have the database add the primary key by 1 for each new row. Thus, the oldest answer will have an id of 1, and the newest id an id of 26 if there are 26 answers in that thread. Hope that makes sense. Anyways, onto my current issue. As I said, I want the answers to be ordered ascending, but after some research, it seems that no one has had the same problem as me (after some Googling). I want my statement to be something like this:
SELECT * FROM forum_answer ORDER BY question_id ASC WHERE question_id='".$id."'"
Code: hatebin (PasteBin sucks I’m sorry)