SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot croman's Avatar
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Query or Database? Sorry, not sure where to fix this

    I have data that I am inputting into a database table

    They are times, however they are in a little different format than normal and I am not sure where to fix this issue

    There is no way to go through and manually edit each one of the records that are being inputted so that is out of the question. I need to find some way to deal with it the way it is.

    Ok, anyways as I said, there is data that I am inputting into the database and part of it is Time data.. problem is, here is how it is shown

    If it is over a minute long, it shows up as
    1:15.4
    that would be 1 Minutes, 15.4 seconds

    If it is under a minute it would be shown as
    39.23
    that would be 39.23 seconds

    If I input it into the database into a TIME field, it changes the data to
    1:15:00
    or
    39:00

    So I can not do that

    If I enter it into the database as a VARCHAR field, it keeps the data just fine, but the sorting then will not work correctly
    Meaning it thinks that 39.23 is bigger than 1:15.4
    so if I tried to sort
    1:15.4
    1:24.7
    39.23
    by the longest time, it thinks that
    39.23 is longer when in all actuality, it is shorter

    So I guess my delima is, is there another Field type I can use that will work for this or do I need to do something in my php query that can straighten this out for me? And if I have to do it code wise, where do I even begin?

    Thanks

  2. #2
    SitePoint Addict devil cat's Avatar
    Join Date
    Apr 2003
    Location
    Reno
    Posts
    344
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Perhaps you should adjust the format of the time to show 0:39.23. Since I'm not sure where this time is coming from, I can't make a recommendation of how to do that.

  3. #3
    SitePoint Zealot croman's Avatar
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by devil cat
    Perhaps you should adjust the format of the time to show 0:39.23. Since I'm not sure where this time is coming from, I can't make a recommendation of how to do that.

    It is coming from an export from another program that I have no control over. Also, there are too many records that are exported for me to manually edit.

    So unfortunately, I need to find a way to deal with it the way it is

  4. #4
    SitePoint Zealot croman's Avatar
    Join Date
    Apr 2003
    Location
    Minneapolis, MN
    Posts
    157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No reason this should have been moved

    This is a issue that I need to resolve with PHP code


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
  •