php - SQLSTATE [42000] when adding data -




when parsing xml file , adding database, displays error during script operation:

$sql->exec("insert 'example' values('$id', '$title', '$link')"); 

sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near ''example' values('phpmysqljquery-przeciagnij-z-wy' @ line 1

can wrong?

you're using wrong quoting style. database, table , column identifiers use different approach:

insert `example` values (?,?,?) 

double , single quotes only strings. can't insert stuff string.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -