CodeIgniter Forums
How to clean up database in MYSQL - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to clean up database in MYSQL (/showthread.php?tid=32687)



How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]parham90[/eluser]
Hi there,

I am not quite sure how I could do this on a Windows host. I want the user accounts created (but not verified) in the last three days to be deleted every day, without a PHP page necessarily having been opened (E.G. something I can do without PHP?). is such a thing possible, or should I just take the best chances and put a PHP script in the homepage to check for these accounts and delete them every time the page is opened?

Thanks!


How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]WanWizard[/eluser]
You can start a PHP script from the commandline, and call that from cron to have it run daily.

With a bit of tweaking you can even start CI controllers from the commandline (search the forum for cron).


How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]parham90[/eluser]
I'm assuming that means it can't be done on a Windows server?


How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]WanWizard[/eluser]
Why not?

On Windows you can do
Code:
C:\PHP5\php.exe -f "C:\PHP Scripts\script.php" -- -arg1 -arg2 -arg3

And use the scheduler to start this (or a batch file containing this) at a set time.


How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]parham90[/eluser]
Ah. I was told (a year or so before) that the scheduler in Windows doesn't work with PHP arguments and such. Thanks for clearing it up!


How to clean up database in MYSQL - El Forum - 07-31-2010

[eluser]WanWizard[/eluser]
I don't use Windows, so I wouldn't know.

But if it doesn't, simply create a batch file, put your PHP commandline in that file, and have the scheduler call that.


How to clean up database in MYSQL - El Forum - 08-01-2010

[eluser]parham90[/eluser]
Thanks!