I am trying to use prepared statement for my PHP SELECT
query but i get this error
SQLite3Stmt::execute() expects exactly 0 parameters, 1 given in C:\xampp\htdocs\xport\post.php on line 75
What could be wrong here? I ma referencing the answer i got here
But this doesn't work.Below is my code.
$postid = (int) $_GET['post_id'];
$userpostquery = "SELECT * FROM users WHERE userid = ?";
$stmt = $db->prepare($userpostquery);
$stmt->execute([$postid]);
while ($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
$cname = $row['cname'];
echo $cname;
}
Thanks.