2
I have the following code:
$sql='ALTER TABLE tributos_prod AUTO_INCREMENT=:ultimo_id';
try {
$query_delete=$conecta->prepare($sql);
$query_delete->bindValue('ultimo_id', $ultimo_idTP+1, PDO: : PARAM_STR);
$query_delete->execute();
}
catch(PDOException $erro) {
echo'[ERRO] ao atualizar AUTO-INCREMENTO: '.$erro->getMessage();
exit;
}
The following error is displayed:
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 ''13'' at line 1
I’ve already checked the variable value $ultimo_idTP
, used intval()
and it’s all right, but I’m not able to identify the problem.
The value of
$ultimo_idTP
would be 12? And why is the value passing as string for the SQL query? It should not be integer?– Woss