How can i save today’s day to a database with php?
I’m trying with:
$datenow=date('Y-m-d');
$stmt = $this->db->prepare("INSERT INTO user (age,wname,slid,time,sex) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("isdds", $year, $reasons,$appy_level,$datenow,$sex);
this isn’t working it writes 0000-00-00 to the database.
Depending on your database setup, remove the PHP date and use the mysql built in
NOW()method. This will require your time field to have a data type of one of DATETIME or similiar.eg: