Trying to update table values using a dropdown. I'm getting number of bound variables does not match number of tokens
whenever I make a selection from the dropdown. I think I've already bound all the variables.
Here's my code:
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$databasename = "companydb";
try
{
$conn = new PDO("mysql:host=$hostname;dbname=$databasename",$username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if(isset($_POST["status"]))
{
$query = "UPDATE tickets SET status = ':status' WHERE ticketno = :ticketno";
$statement = $conn->prepare($query);
$statement->execute(array(':status' => $_POST["status"],':ticketno' => $ticketno));
$count = $statement->rowCount();
if($count > 0)
{
echo "Data Inserted Successfully..!";
}
else
{
echo "Data Insertion Failed";
}
}
else
{
echo "unknown index: 'status'";
}
}
catch(PDOException $error)
{
echo $error->getMessage();
}
?>