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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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