php - You have an error in your SQL syntax - unable to find error -



php - You have an error in your SQL syntax - unable to find error -

i seems have sytax error within code cannot see why.

the line in question here:

mysqli_query($db,"insert `horses` (`parentid`,`date`,`track`,`runners`, `going`, `distance`,`class`,`place`,`losing_dist`,`stall`,`horse`,`weight`,`trainer`,`odds`,`oddsmovement`,`jockeys_claim`,`comments`,`race_name` )values ('$id ',' $thedate','$thecourse','$noinrace','$going','$distance','$class','$place','$distance_bt','$stall','$horse','$weight','$thetrainer','$odds','$oddsmovement','$thejockey','$comments','$event')")or die(mysqli_error($db));

and total error here

you have error in sql syntax; check manual corresponds mysql server version right syntax utilize near 'meara ',' 22/1 ','25/1 < 22/1','d nolan','',' royal marines ' @ line 1

the line in says near this: '$thetrainer','$odds','$oddsmovement','$thejockey'

the database set fields varchat(250) aparent parent id , id int

any farther info please allow me know

this should work if values in php variables valid:

mysqli_query($db,"insert horses (date,track,runners,going,distance,class,place,losing_dist,stall,horse,weight,trainer,odds,oddsmovement,jockeys_claim,comments,race_name) values ({$thedate},{$thecourse},{$noinrace},{$going},{$distance},{$class},{$place},{$distance_bt},{$stall},{$horse},{$weight},{$thetrainer},{$odds},{$oddsmovement},{$thejockey},{$comments},{$event})")or die(mysqli_error($db));

like mentioned in comments above if public page should protect 1 time again sql injection there several techniques google if aren't sure how.

php mysql

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -