I'd like to use a variable number of seconds ($seconds_to_add) in the DATE_ADD() function but it dosen't work. Is it possible ?
<?php
$requete = $pdo->prepare('UPDATE pages SET
vote_time_limit = DATE_ADD(vote_time_limit, INTERVAL :seconds_to_add SECOND)
WHERE page_ID=:id_page');
$requete->bindValue(':id_page', $id_page);
$requete->bindValue(':seconds_to_add', $seconds_to_add);
Bind it as an int, because the default is a string (which includes quotes).
$requete->bindValue(':seconds_to_add', $seconds_to_add, PDO::PARAM_INT);
I recommend you do it on the ID too.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.