Answer the question
In order to leave comments, you need to log in
How to delete specific rows by timeframe in MYSQL DB?
The meaning is as follows.
There is a table where data is entered after the buyer makes a purchase
. Id, key, amount, dt_start, dt_end The
buyer is issued a temporary key so that he can use the service
The moment of activation and the moment the key ends.
The question is, how do I remove the key line when the key expires?
$query = "DELETE FROM n_table WHERE 'dt_start' <= NOW() AND 'dt_end' <= NOW()";
mysqli_query($db, $query);
Answer the question
In order to leave comments, you need to log in
Solve with this line
$query = "DELETE FROM `number` WHERE dt_end < NOW() - INTERVAL 30 second";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question