I have tried to insert into a database with an auto increment number and date, but it's not working. This is my table from the database:
id int not null AUTO_INCREMENT primary key,
dates datetime
This is my code
$dates=date("Y-m-d H:i:s");
$stmt=$conn->prepare('insert into tblpdo values(:id,:dates)');
$stmt->execute(array(':id',':dates'=>$dates));
I am getting the following error:
ERROR: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
i found myself. must declare column and not input id with auto increment
$stmt=$conn->prepare('insert into tblpdo(dates) values(:dates)'); $stmt->execute(array(':dates'=>$dates));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments