I want to start a php class file from server side.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sankarsubramanian
Forum Newbie
Posts: 6
Joined: Sat Dec 23, 2006 1:18 am

I want to start a php class file from server side.

Post by sankarsubramanian »

I want to start a php class file from server side which should delete records from the table which are one month older.
sankarsubramanian
Forum Newbie
Posts: 6
Joined: Sat Dec 23, 2006 1:18 am

is it possible

Post by sankarsubramanian »

is it possible
User avatar
Fractal
Forum Commoner
Posts: 54
Joined: Tue Aug 16, 2005 1:28 pm

Re: is it possible

Post by Fractal »

sankarsubramanian wrote:is it possible
Yes, but all you need to use is a function.. Most of the time there is no point to creating a class for 1 function.
sankarsubramanian
Forum Newbie
Posts: 6
Joined: Sat Dec 23, 2006 1:18 am

if i write a function, how can it be called??

Post by sankarsubramanian »

if i write a function, how and when will it be called??
sankarsubramanian
Forum Newbie
Posts: 6
Joined: Sat Dec 23, 2006 1:18 am

is it possible to call the function automatically??

Post by sankarsubramanian »

is it possible to call the function automatically by any mean??
sankarsubramanian
Forum Newbie
Posts: 6
Joined: Sat Dec 23, 2006 1:18 am

am new tp php

Post by sankarsubramanian »

am new to php... please help meeeee
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

While you're waiting for an answer you might want to read viewtopic.php?t=8815. (And after that you might want to search the web for 'cron')
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

also, you could just set up a check for this any time somebody visits your page... so add something like this to the top of whatever page it is

Code: Select all

<?php
$db = mysql_connect($host, $user, $pass);
$result = mysql_query('DELETE FROM table WHERE date < ' . $one_month_ago);
?>
This is not working code fyi, it's just an example of what you could do.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:4. All users of any level are restricted to bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not receive a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
Post Reply