'Parameterized query not working with PHP mysql [duplicate]

i have table name "pages" with "id,title,slug" columns,I am working on core php and trying to use "parameterized update query",whenever i execute my query then its giving me following error

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables

Here is my code,Where i am wrong ?

$sql = "UPDATE pages SET title=? WHERE slug=? AND id=?";
$stmt= $conn->prepare($sql);
$stmt->bind_param($title,$slug,$headingid);
$stmt->execute();


Solution 1:[1]

While binding a param you should defined what type of is it, like in your case as I guess, title is string, slug is string and id is integer

$sql = "UPDATE pages SET title=? WHERE slug=? AND id=?";
$stmt= $conn->prepare($sql);
$stmt->bind_param("ssi", $title,$slug,$headingid);
$stmt->execute();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hammer