I’ve been trying to figure out how to fix this for about two hours, except I can’t. Yesterday everything worked well despite this error but today without me touching anything it does not work anymore.
This is my code:
$getprod_t = $bdd->prepare("SELECT id, author, item, qte, type,
DATE_FORMAT(datee, \'%d/%m/%Y - %H:%i\') AS datee
FROM registre
WHERE author=:author
AND item=:item
AND type=1");
$getprod_t->execute([
'author' => $_SESSION['username'],
'item' => 3
]);
$prod_t = $getprod_t->fetch();
echo $prod_t['qte'];
Today, When I remove the DATE_FORMAT it works again, except that yesterday I didn’t need to remove it, everything worked fine.
Sincerely,
My Answer:
>query("SELECT DATE_FORMAT(date, '%d/%m/%Y') AS formatted_date FROM products");
while($row = $getprod_t->fetch()){
echo $row['formatted_date'];
}
Rate this post
3 of 5 based on 6542 votesComments