runnerjp Posted October 15, 2014 Share Posted October 15, 2014 Im trying to add value into my database and i keep getting the following error "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 '','','4','Telegraph (IRE)','3','9-3','','57','Evans, P D','28/1 ','Egan, John '' at line 1" my query looks like this mysqli_query($db,"INSERT INTO `Horses` (`Date`,`Track`,`Runners`, `Going`, `Distance`,`Class`,`Place`,`Losing_Dist`,`Stall`,`Horse`,`Age`,`Weight`,`Headgear`,`Horse_OR`,`Trainer`,`Odds`,`Jockeys_Claim`,`Comments`,`Race_Name` )VALUES ('$date','$place','$norunner','$going','$distance','$class',$place','$distance_bt','$stall','$horse','$age','$weight','$headgear','$OR','$trainer','$odds','$jockey','$comments','$event')")or die(mysqli_error($db)); and my table looks like this:Column Type Null DefaultID int(255) No Date varchar(250) Yes NULLTrack varchar(100) Yes NULLRunners varchar(50) Yes NULLGoing varchar(50) Yes NULLDistance varchar(50) Yes NULLClass varchar(50) Yes NULLPlace varchar(10) Yes NULLLosing_Dist varchar(50) Yes NULLStall varchar(250) Yes NULLHorse varchar(50) Yes NULLAge varchar(50) Yes NULLWeight varchar(50) Yes NULLHeadgear varchar(50) Yes NULLHorse_OR varchar(50) Yes NULLTrainer varchar(50) Yes NULLOdds varchar(50) Yes NULLJockeys_Claim varchar(50) Yes NULLComments varchar(250) Yes NULLRace_Name varchar(250) Yes NULL Quote Link to comment https://forums.phpfreaks.com/topic/291629-unable-to-solve-you-have-an-error-in-your-sql-syntax/ Share on other sites More sharing options...
Solution mac_gyver Posted October 15, 2014 Solution Share Posted October 15, 2014 you are missing one single-quote in your sql syntax. did you even look at the code you typed, at the point where the error is being reported in the sql statement, to find the problem? Quote Link to comment https://forums.phpfreaks.com/topic/291629-unable-to-solve-you-have-an-error-in-your-sql-syntax/#findComment-1493575 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.