Problem with SQL queries in php arcade script

Discussion in 'PHP' started by aleiderman, Aug 7, 2007.

  1. #1
    Hello all, I have an arcade site that until this morning was working flawlessly.

    Since 10 am, every time I try to play a game in my site, it throws me a SQL Query error
    Query: SELECT * FROM games WHERE cat=\'Rompecabezas\' AND id!=\'1006\' ORDER BY RAND() DESC LIMIT 0, 9
    Code (markup):
    I noticed that this sql query is always going to give an error because of the backslashes, but as the query is created dinamically, I don't know if I have to make modifications in the php file that calls the query, or in the databse itself.

    Any help would be greatly appreciated.

    AL
     
    aleiderman, Aug 7, 2007 IP
  2. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #2
    You can't remove the slashes from the DB so you will have to do it in the script after collecting from the DB using

    stripslashes($string);

    Thanks
     
    liam1412, Aug 7, 2007 IP
  3. infogle

    infogle Prominent Member

    Messages:
    2,732
    Likes Received:
    128
    Best Answers:
    1
    Trophy Points:
    300
    #3
    At the moment i think site is working... fine... may be some sql error from server...
     
    infogle, Aug 7, 2007 IP
  4. aleiderman

    aleiderman Peon

    Messages:
    132
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, somehow it started working again like an hour ago.

    Still, I would like to understand what happened before, it's strange that in some periods of time it would give a sql error, and then just disappear.

    Doing some research on the web, found that the probable cause is the backslashes in the query, but still, haven't got a clue on how to optimize the queries in the script.
     
    aleiderman, Aug 7, 2007 IP
  5. aleiderman

    aleiderman Peon

    Messages:
    132
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Today I have the same SQL Query problem, any ideas on what may be causing it or how to fix it. Thanks in advance
     
    aleiderman, Aug 14, 2007 IP
  6. liam1412

    liam1412 Active Member

    Messages:
    387
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    60
    #6
    Can you provide me with the code that builds the query please and I will have a look

    Thanks
     
    liam1412, Aug 14, 2007 IP