webapp rec – SQL query to update item quantity using PHP PDO

Good morning everyone

I am trying to update the table with the new quantity selected, when I run the following function, however, I get this error:

Fatal error: Uncaught PDOException: SQLSTATE(HY093): Invalid parameter number: number of bound variables does not match number of tokens in C:xampphtdocsphp_AssessmentsshoppingListmodelfunctions_products.php:11 Stack trace: #0 C:xampphtdocsphp_AssessmentsshoppingListmodelfunctions_products.php(11): PDOStatement->execute() #1 C:xampphtdocsphp_AssessmentsshoppingListcontrollerproduct_update_process.php(21): update_item(’57’, ‘3’, ‘1’) #2 {main} thrown in C:xampphtdocsphp_AssessmentsshoppingListmodelfunctions_products.ph

Function to update the quantity:

function update_item($soldID, $orderedQuantity, $itemQuantity)
  global $conn;
  $sql = "UPDATE shopping_items.sold SET orderedQuantity = :itemQuantity WHERE soldID = :soldID";
  $statement = $conn->prepare($sql);
  $statement->bindValue(':soldID', $soldID);
  $statement->bindValue(':orderedQuantity', $orderedQuantity);
  $statement->bindValue(':itemQuantity', $itemQuantity);
  $result = $statement->execute();
  return $result;


What could be the issue here?

Thanks for your assistance.