syntax error

Discussion in 'PHP' started by promotingspace.net, Mar 13, 2010.

  1. #1
    Hi
    In my file upload codes, I can't solve the syntax error:

    Here is the query:
    INTO `downloads`( `id`, `dir`, `filename`, `description`, `username`, `password` ) VALUES ('fb47559f07645af7a1292460b59c7694', 'G:\Programs new\netservers\www\food\uploadedfiles\fb47559f07645af7a1292460b59c7694\', '98-F-PTL-597.pdf','pdf', 'javad', '123') 
    Code (markup):
    and here is the error
    Thanks for your help

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '98-F-PTL-597.pdf','pdf', 'javad', '123')' at line 5
     
    promotingspace.net, Mar 13, 2010 IP
  2. wadus

    wadus Active Member

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #2
    You problem is right here:

    9c7694\',

    You're escaping the quote character. You should escape the backslash. The proper way to do this query is to escape every backslash because is a special character. So your query would become:

    INTO `downloads`( `id`, `dir`, `filename`, `description`, `username`, `password` ) VALUES ('fb47559f07645af7a1292460b59c7694', 'G:\\Programs new\\netservers\\www\\food\\uploadedfiles\\fb47559f07645af7a1292460b59c7694\\', '98-F-PTL-597.pdf','pdf', 'javad', '123') 
    Code (markup):
     
    wadus, Mar 13, 2010 IP