After an upgrade to PHP 8.2 I got the message:
SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens.
See my code below
<?php
$id1 = "one";
$id2 = "two";
if $row['name'] == $id1)
{
$value = "1";
$page_id = 1;
}
if $row['name'] == $id2)
{
$value = "2";
$page_id = 2;
}
$stmt = $pdo->prepare('SELECT AVG(rating) AS overall_rating, COUNT(*) AS total_reviews
FROM reviews WHERE page_id = '.$value.' AND status = 1');
$stmt->execute([$_GET['page_id']]);
$reviews_info = $stmt1->fetch(PDO::FETCH_ASSOC);
Have I to bind some values?
Thanks in advance!