mmtalon Posted January 27, 2006 Share Posted January 27, 2006 MySQL syntax help "grave accent" !!!I was attemping to insert the $keys/values below into MySQL DB after including the latitude and longitude. Here are values ('37.833526' , '-122.27078'), respectively.code example:/ *** Set $long_keys and $long_values *** /$long_keys = "(h_features,c_features,lat,long,dateposted,";$long_values = " values ('$h_features','$c_features','$latitude','$longitude','$mysql_date'," ;I continued to get the error message "You have an error in your SQL syntax;".NOW, I was banging my head against a wall trying anything I could find to make this work, addslashes-real escapes-dbl and single quotes(with/without periods). Everything seemed to fail, until I remembered seeing some INSERT INTO code using the grave accent. To my surprise, this worked when I tried it.E.g. ($long_keys = "(h_features,c_features,`lat`,`long`,dateposted,";)By running some test, I know that the purpose of the accents has something to do with escaping the hyphen in the longitude value. Unsuccessfully, I have searched to find information on how PHP or MySQL is parsing this code. I was wonder if anyone has a clue to where I can get more information regarding the use of the "grave accent" punctuation in relation to PHP and MySQL??? I also welcome any knowledge that you have on this subject.Thank you in advance for your consideration and any input that you offer.Enquiry mind wants to know,mmtalon Quote Link to comment https://forums.phpfreaks.com/topic/3261-mysql-syntax-help-grave-accent/ Share on other sites More sharing options...
Honoré Posted January 27, 2006 Share Posted January 27, 2006 [!--quoteo(post=340336:date=Jan 27 2006, 11:30 AM:name=mmtalon)--][div class=\'quotetop\']QUOTE(mmtalon @ Jan 27 2006, 11:30 AM) [snapback]340336[/snapback][/div][div class=\'quotemain\'][!--quotec--]MySQL syntax help "grave accent" !!![/quote]The ` character is used to surround reserved words that you want to use as names, i.e. as database name, table name or column name.In your example you use the reserved words lat and long as column names. Quote Link to comment https://forums.phpfreaks.com/topic/3261-mysql-syntax-help-grave-accent/#findComment-11139 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.