0

INSERT INTO all_contributions (ID, dateofpayment, Incometype, Serialnumber, Contacttype, Firstname, Autoid, Destinationcode, Destinationcode2, Admitname, paymentamount, taxclaimable, is_processed,Paymenttype) VALUES (NULL, 01/09/2013, DONATION, 000xxxx, Individual, Andy, PLG0003671402, WEB, 473501, B21094, 16.67, No, 0, Direct Debit);

Invalid insert query #1: 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 'Debit)' at line 5

This is from a PHP script, with the values shown coming from a file to an array called $parts. The value of Paymenttype is 'DIRECT DEBIT' and the PHP variable used is $parts[4]. It appears that having 2 words in the field causes the problem? All the table fields except is_processed are varchar (and Paymenttype is varchar(20)), but the error says syntax and I can't see what's wrong. I'm a MYSQL beginner, btw. I have wrestled this for quite a while and have tried moving fields around but it hasn't helped! The field names have left ticks around them, btw. I'm using MYSQL 5.5.45-cll

Andy Clark
  • 101
  • 3

0 Answers0