Jump to content

Eltik

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Eltik

  1. 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. (cause I can't share images, here) Chat: ID: 1 Yo. Anyone here? ID: 2 Yep. This website is pretty cool. ID: 3 I agree. 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: https://hatebin.com/qnqhnidqsh
×
×
  • 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.