86Stang Posted March 28, 2008 Share Posted March 28, 2008 I've got a field with float(10,6) as the type to accommodate coordinates (latitudes & longitudes). I'm running the below to try and update it: $qry = "UPDATE table SET address='$address', phone='$phone', lat='$lat', $lng='$lng' WHERE id = $id"; mysql_query($qry) or die ("Error during query!" . mysql_error()); but it's kicking this back at me: Error during query!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 '0.000000='0.000000' WHERE id = 20' at line 1 Any ideas? Can you not update floats like other field types? Link to comment https://forums.phpfreaks.com/topic/98340-updating-a-float-field/ Share on other sites More sharing options...
JD* Posted March 28, 2008 Share Posted March 28, 2008 $qry = "UPDATE table SET address='$address', phone='$phone', lat='$lat', $lng='$lng' WHERE id = $id"; Reason it's messed up is because you have $lng=$lng. Change it to lng=$lng Link to comment https://forums.phpfreaks.com/topic/98340-updating-a-float-field/#findComment-503242 Share on other sites More sharing options...
86Stang Posted March 28, 2008 Author Share Posted March 28, 2008 Doh! Ha!!! Excuse me while I beat the stupidity out of myself! Link to comment https://forums.phpfreaks.com/topic/98340-updating-a-float-field/#findComment-503277 Share on other sites More sharing options...
cooldude832 Posted March 28, 2008 Share Posted March 28, 2008 Doh! Ha!!! Excuse me while I beat the stupidity out of myself! read your mysql error next time and you should realize that the 0.00000=0.00000 part is the issue and then say I don't have a field name 0.00000 and you solved your own problem Link to comment https://forums.phpfreaks.com/topic/98340-updating-a-float-field/#findComment-503286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.