Adambrz Posted August 24, 2006 Share Posted August 24, 2006 I have tried a few different methods to get this to work but for some reason my escape character is not working. my php is set to automatically add the escape and i printed out string to make sure it does have the escape character. This works fine with my update statement but my insert statement just won't work. The error message I receive is (the 0 are supposed to be there: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 '\'s, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ' at line 1 $insertSQL = "INSERT INTO flash (ID, Client, AAC_Jan_Budget, AAC_Jan_Flash, AAC_Feb_Budget, AAC_Feb_Flash, AAC_Mar_Budget, AAC_Mar_Flash, AAC_Apr_Budget, AAC_Apr_Flash, AAC_May_Budget, AAC_May_Flash, AAC_Jun_Budget, AAC_Jun_Flash, AAC_Jul_Budget, AAC_Jul_Flash, AAC_Aug_Budget, AAC_Aug_Flash, AAC_Sept_Budget, AAC_Sept_Flash, AAC_Oct_Budget, AAC_Oct_Flash, AAC_Nov_Budget, AAC_Nov_Flash, AAC_Dec_Budget, AAC_Dec_Flash, ACA_Jan_Budget, ACA_Jan_Flash, ACA_Feb_Budget, ACA_Feb_Flash, ACA_Mar_Budget, ACA_Mar_Flash, ACA_Apr_Budget, ACA_Apr_Flash, ACA_May_Budget, ACA_May_Flash, ACA_Jun_Budget, ACA_Jun_Flash, ACA_Jul_Budget, ACA_Jul_Flash, ACA_Aug_Budget, ACA_Aug_Flash, ACA_Sept_Budget, ACA_Sept_Flash, ACA_Oct_Budget, ACA_Oct_Flash, ACA_Nov_Budget, ACA_Nov_Flash, ACA_Dec_Budget, ACA_Dec_Flash, AWB_Jan_Budget, AWB_Jan_Flash, AWB_Feb_Budget, AWB_Feb_Flash, AWB_Mar_Budget, AWB_Mar_Flash, AWB_Apr_Budget, AWB_Apr_Flash, AWB_May_Budget, AWB_May_Flash, AWB_Jun_Budget, AWB_Jun_Flash, AWB_Jul_Budget, AWB_Jul_Flash, AWB_Aug_Budget, AWB_Aug_Flash, AWB_Sept_Budget, AWB_Sept_Flash, AWB_Oct_Budget, AWB_Oct_Flash, AWB_Nov_Budget, AWB_Nov_Flash, AWB_Dec_Budget, AWB_Dec_Flash, HTX_Jan_Budget, HTX_Jan_Flash, HTX_Feb_Budget, HTX_Feb_Flash, HTX_Mar_Budget, HTX_Mar_Flash, HTX_Apr_Budget, HTX_Apr_Flash, HTX_May_Budget, HTX_May_Flash, HTX_Jun_Budget, HTX_Jun_Flash, HTX_Jul_Budget, HTX_Jul_Flash, HTX_Aug_Budget, HTX_Aug_Flash, HTX_Sept_Budget, HTX_Sept_Flash, HTX_Oct_Budget, HTX_Oct_Flash, HTX_Nov_Budget, HTX_Nov_Flash, HTX_Dec_Budget, HTX_Dec_Flash) VALUES (NULL, $client, $aacjanb, 0, $aacfebb, 0, $aacmarb, 0, $aacaprb, 0, $aacmayb, 0, $aacjunb, 0, $aacjulb, 0, $aacaugb, 0, $aacsepb, 0, $aacoctb, 0, $aacnovb, 0, $aacdecb, 0, $acajanb, 0, $acafebb, 0, $acamarb, 0, $acaaprb, 0, $acamayb, 0, $acajunb, 0, $acajulb, 0, $acaaugb, 0, $acasepb, 0, $acaoctb, 0, $acanovb, 0, $acadecb, 0, $awbjanb, 0, $awbfebb, 0, $awbmarb, 0, $awbaprb, 0, $awbmayb, 0, $awbjunb, 0, $awbjulb, 0, $awbaugb, 0, $awbsepb, 0, $awboctb, 0, $awbnovb, 0, $awbdecb, 0, $htxjanb, 0, $htxfebb, 0, $htxmarb, 0, $htxaprb, 0, $htxmayb, 0, $htxjunb, 0, $htxjulb, 0, $htxaugb, 0, $htxsepb, 0, $htxoctb, 0, $htxnovb, 0, $htxdecb, 0)";And help would be most...helpful.-Adambrz Quote Link to comment Share on other sites More sharing options...
SharkBait Posted August 24, 2006 Share Posted August 24, 2006 One thing I do with my variables in the VALUES section is '{$valuename}', '{$valuename2}'As for your escape character, how are you doing it?I do something like [code=php:0]$name = str_replace("'", "\'", trim($_POST['name']));[/code]Other use the mysql_escape_character() function.Show your code for escaping and we can look further into it for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.