Answer the question
In order to leave comments, you need to log in
How to determine the % of the distance traveled?
For example, there are 100500 posts on the site. A script is launched that finds the desired posts using a regular expression (MySQL). Let's say that the script goes through 500 posts in one run, writes down the post ID at the end of its work, and continues to work the next time it is run.
How to determine the number of passed news in% knowing the ID of the post where the script stopped?
Answer the question
In order to leave comments, you need to log in
SELECT (SELECT COUNT(*) FROM posts WHERE id <= $lact_checked_id)/(SELECT COUNT(*) FROM posts)*100 as percent
Save the number of posts passed and the number of all posts. To divide one into another, I think, it is not necessary to learn)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question