Datetime Insert in MySQL Using mysqli bind_param
MySQL's date and time columns can be populated through PHP mysqli's bind_param. Simply treat them as strings during the insertion process.
Example:
<code class="php">$stmt = $mysqli->prepare('insert into foo (dt) values (?)'); $dt = '2009-04-30 10:09:00'; $stmt->bind_param('s', $dt); $stmt->execute();</code>
The above is the detailed content of How to Insert Datetime Values into MySQL Using mysqli bind_param?. For more information, please follow other related articles on the PHP Chinese website!