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
Post a Comment