I am working on a News article update page and I am experiencing a problem that generates the following error when the update form is submitted. I am using PHP with MySQL.
Uncaught ArgumentCountError: The number of elements in the type definition string must match the number of bind variables
Here is the code snippet containing the query with the PreparedStatement.
if (isset($_POST['submit']))
{
$aid = $_GET['id'];
$atitle = $_POST['title'];
$aauthor = $_POST['author'];
$acat = $_POST['category'];
$acontent = $_POST['content'];
$apublishdate = $_POST['publishdate'];
$stmt = mysqli_prepare($conn, "UPDATE news_articles SET article_category = ?, article_publish_date = ?, article_title = ?, article_author = ?, article_content = ? WHERE article_id = ?");
$stmt->bind_param($acat, $apublishdate, $atitle, $aauthor, $acontent, $aid);
$stmt->execute();
}
Please let me know if you need any additional code. I appreciate any suggestions. Thanks in advance!
source https://stackoverflow.com/questions/77129537/uncaught-argument-error-with-mysql-prepared-update-statement
No comments:
Post a Comment