Trying to delete records from a table. I have looke on line and I am following the examples but I can't get prepare() and execute() to work.
function DeleteOldData()
{
$pdo = connectDB();
$Date = time();
$Month = date('m' ,$Date);
$Year = date('Y' ,$Date);
$Month -= 1;
if ($Month == 0)
{
$Month = 12;
$Year -= 1;
}
$Date = $Year . "-" . $Month . "-01";
$sqlOldData = "DELETE from `Bank_Data` Where EntryDate < ? ";
$stmt= $pdo->prepare($sqlOldData);
$return = $stmt->execute($Date);
exit;
}