0

I have a column in MYSQL database that hold the date and time.

it looks like this:

2017-05-24 06:10:15

I need to periodically check if 5 minutes passed this datetime and then execute something else:

I tried this:

$sqld = "SELECT * FROM orders";
$queryd = mysqli_query($db_conx, $sqld);
$productCountd = mysqli_num_rows($queryd); // count the output amount
if ($productCountd > 0) {
    while($rowd = mysqli_fetch_array($queryd, MYSQLI_ASSOC)){ 
             $dbdate = $rowd["date_added"];


             $dbdate = strtotime($datefromdb);

             if (time() - $dbdate > 5 * 60) {

             echo 'passed';

              }




    }
} else {
}

But this code always echo's passed even if the time hasn't passed the 5 minutes!

Could someone please advise on this issue?

is there any MYSQL query that would do the same?

David Hope
  • 1,426
  • 4
  • 21
  • 50

0 Answers0