How to Insert Datetime Values into MySQL Using mysqli bind_param?

Barbara Streisand
Release: 2024-10-27 16:31:02
Original
121 people have browsed it

How to Insert Datetime Values into MySQL Using mysqli bind_param?

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>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!