Hi,
I am building an update query which will update a record in a table, but I am getting an error which doesn’t make sense to me.
Here is my code:
$query = “UPDATE iknew
SET ID=’$id’,
SET Herbarium=’$herbarium’,
SET Taxon=’$taxon’,
SET Bar_Code=’$bar_code’,
SET GUID=’$guid’,
SET Private=’$private’,
SET Image=’$image’,
SET Kingdom=’$kingdom’,
SET Genus=’$genus’,
SET Species=’$species’,
SET Variety_Name=’$variety_name’,
SET Taxon_Author=’$taxon_author’,
SET Accession=’$accession’,
SET State=’$state’,
SET County=’$county’,
SET Habitat=’$habitat’,
SET Locality=’$locality’,
SET Latitude=’$latitude’,
SET Longitude=’$longitude’,
SET Quadrangle=’$quadrangle’,
SET Collector=’$collector’,
SET Collection_Number=’$collection_number’,
SET Country=’$country’,
SET Family=’$family’,
SET Annotation=’$annotation’,
SET Col_Date=’$col_date’,
SET Comments=’$comments’,
SET Natural_Area=’$natural_area’,
SET Col_datet=’$col_datet’,
SET Symbol=’$symbol’
WHERE ID=’$id’ LIMIT 1”;
Here is a sample update query:
UPDATE iknew SET ID=‘62547’, SET Herbarium=‘EKY’, SET Taxon=‘Salix exigua Nutt.’, SET Bar_Code=‘3288’, SET GUID=’’, SET Private=‘1’, SET Image=’’, SET Kingdom=‘Plantae’, SET Genus=‘Salix’, SET Species=‘exigua’, SET Variety_Name=’’, SET Taxon_Author=‘Nutt.’, SET Accession=‘EKY3288’, SET State=‘Kentucky’, SET County=‘Madison’, SET Habitat=‘stream bank’, SET Locality=‘Hagan Mill Road at bridge over Silver Creek.’, SET Latitude=’ 0’, SET Longitude=’ 0’, SET Quadrangle=’’, SET Collector=‘John Hornback’, SET Collection_Number=‘38’, SET Country=‘USA’, SET Family=‘Salicaceae’, SET Annotation=’’, SET Col_Date=‘1976-04-18’, SET Comments=‘RRP’, SET Natural_Area=’’, SET Col_datet=’’, SET Symbol=‘SAEX’ WHERE ID=‘62547’ LIMIT 1
And here is the error given:
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 ‘SET Herbarium=‘EKY’, SET Taxon=‘Salix exigua Nutt.’, SET Bar_Code=‘3288’, SET’ at line 3
Any help would be quite appreciated.