Jump to content

ORDER BY question


rasafrasit

Recommended Posts

More of a strict SQL question but here it is nonetheless:

I recently added a new record to a table that feeds my php-based resume. Because the key is auto increment, the new record fell to the bottom of the list but I want it to appear at the top so I bumped all the key values for the existing records and set the new record to have the lowest value in the key field. However, when I refresh my url the new record appears at the bottom. Why is this? I've confirmed via phpMyAdmin and mySQL that the changes to the records took but still no love. I have also tried inserting an ORDER BY command into the php of the page itself but, again, no love. What gives? Any ideas?

Thanks,

rasafrasit
Link to comment
https://forums.phpfreaks.com/topic/7861-order-by-question/
Share on other sites

Have you tried:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]`table`[/color] [color=green]ORDER BY[/color] id [color=green]DESC[/color] [!--sql2--][/div][!--sql3--] (When id is the column with the auto_increment) Or something else?

Orio.
Link to comment
https://forums.phpfreaks.com/topic/7861-order-by-question/#findComment-28651
Share on other sites

[!--quoteo(post=366499:date=Apr 19 2006, 12:09 PM:name=Orio)--][div class=\'quotetop\']QUOTE(Orio @ Apr 19 2006, 12:09 PM) [snapback]366499[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Have you tried:[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] * [color=green]FROM[/color] [color=orange]`table`[/color] [color=green]ORDER BY[/color] id [color=green]DESC[/color] [!--sql2--][/div][!--sql3--] (When id is the column with the auto_increment) Or something else?

Orio.
[/quote]

AHA! Thanks, I was trying to put the ORDER BY in a separate command. Many thanks.
Link to comment
https://forums.phpfreaks.com/topic/7861-order-by-question/#findComment-28689
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.