Welcome Guest, Not a member yet? Register   Sign In
proper place to insert code
#1

[eluser]Marc Arbour[/eluser]
Dear CI community.

I need help with the fact I have a small learning disability that prevents me from going through the user_guide or reading extensively on forums. I get confused too quickly and tend never to find my answer. But I am not stupid since I have created 2 cool websites with the help of CodeIgniter.

I just need to be pointed in the right direction. That's all.

What I need as an answer: I need for you just to tell me, as examples,
1- this should go in a class that should work this way
2- this should go in a helper that should be loaded in such a maner
3- anything that tells me how and what... I'll manage with reading/learning alone afterwards.

What is, in your opinion, the best place to insert code to be executed "once a day"? (or, if need be, more often but not at every page view)

Explanations: Once a day I need to delete specific records from a table in a database. I would like this to be cron independant in case we move the website to another server.

Requirements: It needs to be in a place where database connection is already done since it's one single line as this one:
Code:
$query = $this->db->query('delete some records where condition is met');

Limitations: I tried putting in controllers initialization in some "more popular" controller, but the downfall is that I need to put it almost everywhere to garantee it's executed at least once daily when only once should be sufficient. Thus freeing server resources.

Thanks for helping out.

Marc.


Messages In This Thread
proper place to insert code - by El Forum - 10-06-2009, 12:25 PM
proper place to insert code - by El Forum - 10-06-2009, 12:41 PM
proper place to insert code - by El Forum - 10-06-2009, 04:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB