L
L
lexstile2018-09-20 12:55:28
PHP
lexstile, 2018-09-20 12:55:28

How can I count the script run by cron?

Essence such, in a file there is a request to a DB.
I need to change the request condition every time this script is run through cron.
Example:

#1
SELECT * FROM table WHERE id < 101
#2
SELECT * FROM table WHERE id > 100 && id < 201
#3
SELECT * FROM table WHERE id > 200 && id < 301
#4
SELECT * FROM table WHERE id > 300 && id < 401
.....................................................................

Question:
In addition to writing a counter to the database or file, are there alternative solutions to the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vyrkmod, 2018-09-20
@vyrkmod

The state must be preserved between script runs, which means external memory must be used. So there really are no alternatives.

M
Maxim Timofeev, 2018-09-20
@webinar

You can also insert a subquery into the request and get an id that can be changed under some conditions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question