Solved

unable to solve You have an error in your SQL syntax;

Posted on 2014-10-15
3
228 Views
Last Modified: 2014-10-15
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      Default
ID      int(255)      No      
Date      varchar(250)      Yes      NULL
Track      varchar(100)      Yes      NULL
Runners      varchar(50)      Yes      NULL
Going      varchar(50)      Yes      NULL
Distance      varchar(50)      Yes      NULL
Class      varchar(50)      Yes      NULL
Place      varchar(10)      Yes      NULL
Losing_Dist      varchar(50)      Yes      NULL
Stall      varchar(250)      Yes      NULL
Horse      varchar(50)      Yes      NULL
Age      varchar(50)      Yes      NULL
Weight      varchar(50)      Yes      NULL
Headgear      varchar(50)      Yes      NULL
Horse_OR      varchar(50)      Yes      NULL
Trainer      varchar(50)      Yes      NULL
Odds      varchar(50)      Yes      NULL
Jockeys_Claim      varchar(50)      Yes      NULL
Comments      varchar(250)      Yes      NULL
Race_Name      varchar(250)      Yes      NULL
0
Comment
Question by:runnerjp2005
  • 2
3 Comments
 
LVL 34

Accepted Solution

by:
Beverley Portlock earned 500 total points
ID: 40381901
The value $place lacks a leading apostrophe

... ng','$distance','$class',$place','$distance_bt'

should be

... ng','$distance','$class','$place','$distance_bt'
0
 

Author Closing Comment

by:runnerjp2005
ID: 40381925
Thanks ... tells me i need a break for lunch lol
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 40381943
:-)

Sometimes a fresh pair of eyes is all that is needed. Thanks for the points and enjoy your lunch
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now