SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    982
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Baffling Error Message

    This has me completely stumped, and I've never see anything like it.

    Here's my query:
    Code:
    SELECT mus_searchsynonyms.good_term
         , mus_searchsynonyms.alt_term
      FROM s01_MUS_SearchSynonyms AS mus_searchsynonyms
     WHERE mus_searchsynonyms.active = 1
       AND mus_searchsynonyms.alt_term = ".quote_smart($search_query)."
       AND mus_searchsynonyms.auto_replace = 0
    When I use PHP to execute the query, I get the following error message (mysql_error()): (obviously <<$search_query>> is whatever the value of the variable is)
    Duplicate entry '1259301982-<<$search_query>>' for key 1
    When I run the query in phpmyadmin, the query is fine...

    First, I don't know why I'd get a key error on a select query, 2nd, there aren't any duplicates in my table...
    MySQL v5.1.58
    PHP v5.3.6

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,347
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    of course there aren't any duplicates in your table, you have a unique index which prevents that

    as for the fact that SELECT doesn't produce this error, you are absolutely right, it doesn't

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    982
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Rudy! I'm still confused

    I'm having all types of odd problems today -- I think it's just me subconsciously killing time until the iPhone launches today...
    MySQL v5.1.58
    PHP v5.3.6


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
  •