SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    date order by question

    when doing this command..
    select title from blah order by date_submit desc

    and then i submit a new blah, it doesn't go to the top of the list... (i have submited a lot of stuff today).. is that because the field isnt datetime as i have it as date? i still woulda thought it would have sorted it to the top if that is the case.

  2. #2
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe i should explain it better...

    when having a field type date... and you have already added several entries, and want to sort the newest addition.. it doesnt seem to go to the top of the list.

  3. #3
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have an auto_increment record_id, you could use it instead of the date_submit field, although I would prefer to add/modify the field to be datetime.
    Lats...

  4. #4
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how can i modify that field from date to datetime?

    cheers.

  5. #5
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're using phpmyadmin, view the structure and click on the 'change' link to make it a datetime. Your existing data will be have ' 00:00:00' added to the date.
    Lats...

  6. #6
    SitePoint Addict
    Join Date
    Oct 2001
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    is there a way to do this thro the mysql command interface?

  7. #7
    SitePoint Wizard Lats's Avatar
    Join Date
    Jun 2003
    Location
    Melbourne, AU
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be something like this...
    Code:
    ALTER TABLE `table_name` CHANGE `date_field` `date_field` DATETIME
    (as suggested by phpmyadmin)
    Lats...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •