SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Compare against Substring of Field

  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    2,895
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Compare against Substring of Field

    I need to take a Filename generated by my PHP script and compare it against the name in the "photo_name" field.

    The problem, is that my PHP script is just generating...

    Code:
    f21190299a795e9cf3439f7f62c223f79e023ab7

    Whereas in the database I have the full Filename and Extension...

    Code:
    f21190299a795e9cf3439f7f62c223f79e023ab7.jpg

    Unfortunately, when I am checking to make sure the new Filename is unique in my PHP Script, I have not determined the MIME type, and so I need a way to do this lopsided comparison, if that makes sense?!

    Thanks,


    Debbie

  2. #2
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,462
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    MIME type?

    also, is this actually a php question?
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    Dumitru "Mitică" UNGUREANU itmitică's Avatar
    Join Date
    Feb 2012
    Location
    Fălticeni
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If generated Filenames are unique (I'm pretty sure they are), you don't need an extension, you only need to remove the last 4 chars for the value from the field in the database table to make an exact match.

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
  •