I have a PHP website in which, when a member visits a page, a series of database maintenance actions are made.
For example, in a common page, I’ve included a PHP script which checks how many posts every user has made and updates the database giving them points accordingly.
The problem with this method is that my website has 100+ members, and I’m worried that my scripts start to slow down as my memberbase grows.
Is there any way to code a bot in PHP, so my database can be updated without the user’s intervention?
You should run a PHP file from within a
cronjob. Most PHP hosts including shared hosting providecronaccess.With
cronyou can schedule a task to run on an interval basis. This PHP program will then go through and do the updating that you require. So… take the code you do now and move it into a seperate PHP file and then tellcronto run it maybe once an hour or whatever you deem to be the correct interval.