Solved

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

Posted on 2014-10-15
3
239 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parse url to form? 7 25
IP 10.0.1.2 / 255.0.0.0 61 56
What if i make webbased alternative for MS Access 5 67
Software for Local History Museum Library 5 46
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 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