MySQL DESC (sorting/ordering) not Working

Status
Not open for further replies.

Artheido

New Member
Messages
13
Reaction score
0
Points
0
Note: I decided not to post this on "Programming Help" because it seems to be more of a hosting problem.

I've been trying to sort out one of my tables in descending order but no matter what I do, it doesn't work.

Example: My current table (Table name is 'Table')

ID | Content |
___|_________|___
1 | xxx |
2 | yyy |
3 | bbb |


and so on.

I want it to go:

ID | Content |
___|_________|___
3 | bbb |
2 | yyy |
1 | xxx |


But when I use "SELECT * FROM Table ORDER BY ID DESC", nothing changes but it returns positive meaning nothing went wrong.
I even tried setting the PRIMARY KEY to DESC but it still didn't work though it went through without any errors.

I can't see any syntax errors in it and I've been error tracking for the past 2 hours.

Strange thing is, it seemed to work fine in the morning but now it's gone completely. Deleted the entire database and started again, still not fixed, checked, repaired tried everything I could. Nothing.

I've googled for a while (a few hours) and it looks like a bug with the current version of MySQL installed on these servers. It's been fixed apparently but in the latest version (5.1?) but we have 5.0.81...

[Sources: 1 2 and a few others]

I'm kinda dead on my tracks now... I was learning so much too...:runaway:

So just wondering (since this is a pretty major bug) if anyone else had this problem and if so how they got around it.

Would be great if x10hosting updated MySQL too :happysad:

EDIT: Managed to use phpMyAdmin to change the order but the script it gives doesn't work inside mysql_query on my PHP page which is the problem...

EDIT2: :eek4: kdone.

Seems for ORDER BY you need to use quotes around the names:

"SELECT * FROM `Table` ORDER BY `ID` DESC"
 
Last edited:
Status
Not open for further replies.
Top