QuePID Posted August 12, 2010 Share Posted August 12, 2010 I am having a problem inserting a record into mysql. below is my query string: INSERT INTO iknew (Herbarium, Taxon, Bar_Code, GUID, Private, Image, Kingdom, Genus, Species, Variety_Name, Ssp_Name, Ssp_Varietal_Name, Taxon_Author, Accession, State, County, Habitat, Locality, Latitude, Longitude, Quadrangle, Collector, Collection_Number, Country, Family, Annotation, Col_Datet, Comments, Natural_Area, Col_Datet, Symbol) VALUES (EKY, Lomatium laevigatum (Nutt.) Coult. & Rose, 403113288, eky0812521, 0, eky0812521.jpg, Plantae, Lomatium, laevigatum, var. esculenta, tragei, locii, (Nutt.) Coult. & Rose, 999999, Kentucky, Harlan , Along river bank, between 3500 and 3580 feet of black mountain, 84° 17\' 21\", 37° 34\' 56\", Benham, Ralph L Thompson and Roanld L Jones and Landon McKinney, 2157, USA, Apiaceae, Lomatium spinosa, 09/17/1989, collected cone, Black Mountain Wilderness Area, 09/17/1989, LOLA3) The error I get is: 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 'laevigatum (Nutt.) Coult. & Rose, 403113288, eky0812521, 0, eky0812521.jpg, Plan' at line 1 Is this because the parenthesis around Nutt. or the & ? I have tried mysql_real_escape_string for every $_POST variable used in the creation of the query string in hopes of adding appropriate backslashes would address the error. What is causing the error and what solutions can I use to remedy this kind of problem with future insertions? Quote Link to comment https://forums.phpfreaks.com/topic/210515-mysql-insert/ Share on other sites More sharing options...
PFMaBiSmAd Posted August 12, 2010 Share Posted August 12, 2010 Each string data value must be enclosed in single-quotes so that it is treated as a string instead of SQL keywords. Quote Link to comment https://forums.phpfreaks.com/topic/210515-mysql-insert/#findComment-1098383 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.