K
K
kuzyairon2020-05-10 09:06:06
PHP
kuzyairon, 2020-05-10 09:06:06

How to create a temporary string in mysql?

I am making an online store for the provision of goods with a time frame.
After a successful payment, a unique key for the user is generated based on the initial payment data (by amount), and this unique string is entered into the database. After that, the buyer activates this key with a POST request on the main page, and this key is compared in the database, that such a key (string) is in the database, after the buyer gets access to a certain temporary product.
The essence of the question is the following, how do I set the time frame for this unique string (key)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sokolov, 2020-05-10
@kuzyairon

Columns dt_startand dt_end, DateTime type?

SELECT code, dt_end
FROM tbl_codes
WHERE code = :code
    AND NOW() >= dt_start
    AND NOW() <= dt_end;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question