Please help me to update date to mySQL. My Add Item is functioning well and Add date to mySQL but when I try to Update, in mySQL the date appears "0000-00-00". Below are my code for update.
<?php
require_once 'dbconfig.php';
if($_POST)
{
$itemid = $_POST['itemid'];
$itemno = $_POST['itemno'];
$itemquantity = $_POST['itemquantity'];
$itemdesc = $_POST['itemdesc'];
$itemuom = $_POST['itemuom'];
$reqdate = $_POST['reqdate'];
$newdate = date('Y-m-d', strtotime($reqdate));
try{
$stmt = $db_con->prepare("UPDATE info SET itemno=$itemno, itemquantity=$itemquantity, itemdesc=$itemdesc, itemuom=$itemuom, reqdate=$newdate WHERE itemid=$itemid");
$stmt->bindParam(":itemno", $itemno);
$stmt->bindParam(":itemquantity", $itemquantity);
$stmt->bindParam(":itemdesc", $itemdesc);
$stmt->bindParam(":itemuom", $itemuom);
$stmt->bindParam(":reqdate", $newdate);
if($stmt->execute())
{
echo "Successfully updated";
}
else{
echo "Query Problem";
}
}
catch(PDOException $e){
echo $e->getMessage();
}
} ?>
I think I have problem in the updating query, Im not so much familiar with mysqli codes. Advance Thanks for the help