Reputation: 1221
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);
Upvotes: 0
Views: 475
Reputation: 174997
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.
Upvotes: 1