I am using PHP(PDO), MYSQL. I have a number of date values stored in my database and am trying to compare my system date with date values stored in the database one by one.
I can compare a single date value, but I am not able to compare all the date values. I want to compare all the date values from the database with my system date and if it matches it should echo.
I know it would be under loop concept, but I don't know how to run loop on that. Is this the correct concept or what?
$sysdate= date("Y-m-d");//system date;
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM setremainder");
$stmt->execute();
$result=$stmt->fetch();
$r1=$result['datetime'];
comparing systemdate with datbase value
if ($r1==$sysdate) {
echo success";
}