php - 'Connection failed: SQLSTATE[42000]: Syntax error or access violation: 1064 -
i working on xampp local server , coding php using netbeans, below code working fine.
$sql = "insert enneagram (name,course,activity,type,peacemaker,loyalist,achiever,reformer,individualist,helper,challenger,investigator,enthusiast,instinctive,feeling,thinking,assertive,dutiful,withdrawn) values ('$answerdata[0]','$answerdata[1]','$answerdata[2]','$mytypes',$a,$b,$c,$d,$e,$f,$g,$h,$i,$instinctive,$feeling,$thinking,$assetive,$dutiful,$withdrawn)";
i uploaded file on online server , giving me error
'connection failed: sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mariadb server version right syntax use near \'. values (\'karim bahsoun\',\'communication\',\'activity\',\'|loyalist|individualis\' @ line 1'
it's third day looking @ code , not realizing why worked offline , not online.
there . after withdrawn) should not there.
also note using post data directly sql leaves wide open sql injections. should use prepared statement
Comments
Post a Comment