Using Mysqli bind_param with date and time columns?

前端 未结 8 934
清歌不尽
清歌不尽 2020-12-08 06:14

How do you insert data into a MySQL date or time column using PHP mysqli and bind_param?

8条回答
  •  误落风尘
    2020-12-08 06:46

    Like any other string

    $stmt = $mysqli->prepare('insert into foo (dt) values (?)');
    $dt = '2009-04-30 10:09:00';
    $stmt->bind_param('s', $dt);
    $stmt->execute();
    

提交回复
热议问题