$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VAULES( `hello`, `hi`, `he`)";
$result = $db->exec($sql);
$insertId = $db->lastInsertId();
is getting this error
DB:SQLSTATE[42000]: Syntax error or access violation: 1064 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 'VAULES( 'hello', 'hi', 'he')' at line 1
I have not using any keywords please help
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VAULES( `hello`, `hi`, `he`)";
VAULES
It should be VALUES
and the query should be look like below -
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VALUES( 'hello', 'hi', 'he')";
$result = $db->query($sql);
for value you have to use single quote or double quote not `
Use '
to quote string literals and typo in VALUES
:
$sql = "INSERT INTO `call-request`(`mob`, `dat`, `nam`) VALUES( 'hello', 'hi', 'h')";