Spot the deliberate mistake...
| From: | Mark Benson | Date: | Thu, 16 Dec 2004 16:49:22 +0000 |
| Subject: | Spot the deliberate mistake... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37717@lists.php.net to get a copy of this message | ||
The following SQL statement returns an error. What is wrong with it? The error is stated as being
near 'ON DUPLICATE KEY UPDATE foo_no='$data[1]', alt_no='$data[2]',
descript='$data[3]', pr'
"INSERT INTO
foobar2 SET part_no='$data[0]',
foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]',
price='$data[4]', unit_sale='$data[5]', unit_issue='$data[6]',
weight='$data[7]', brand='$data[8]', nla_tag='0' ON DUPLICATE KEY
UPDATE foo_no='$data[1]', alt_no='$data[2]', descript='$data[3]',
price='$data[4]', unit_sale='$data[5]', unit_issue='$data[6]',
weight='$data[7]', brand='$data[8]', nla_tag='0'"
This is passed in a PHP script so the line ending ';' is not present.
I'm getting better at writing SQL statements but sometimes it just throws me a total curved
ball!
--
Mark Benson
http://homepage.mac.com/markbenson