Guys, I want to correct this function the request from DB its works fine but I want to use it as a function so I can repeat it 30 times
the problem here is I don't know really how to use it into a function
<?php
$today = date("Y-m-d") ;
function getDateFunc($today) {
$getttlprice = "SELECT SUM(price) AS TotalPrice FROM orders WHERE ldate = :today";
$ttp = $pdo->prepare($getttlprice);
$ttp->execute(array(':today'=>$today));
$resultttp = $ttp->fetchObject();
$todayresulte = $resultttp->TotalPrice;
echo $todayresulte ;
}
getDateFunc('16-06-2018') ;
?>
normally the function is like this but I don't know how to use it with my requst
function getDateFunc($today){
echo $today ; // resulte 16/06/2018 by today time
}