By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,391 Members | 1,604 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,391 IT Pros & Developers. It's quick & easy.

PHP MySQL

P: n/a
Hello . . .

I need some help . . .

I have a question . . .

how can i delete from MySQL database table automatic expired records ?
? ?

One think is to make a service that deleting the expired records . . .

Any other method ? ? ?

Thanks a lot . . . :D

Nov 13 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a

me***********@gmail.com wrote:
Hello . . .

I need some help . . .

I have a question . . .

how can i delete from MySQL database table automatic expired records ?
? ?

One think is to make a service that deleting the expired records . . .

Any other method ? ? ?

Thanks a lot . . . :D
Depending on how your records become expired, you could try using a
mysql trigger.

http://dev.mysql.com/doc/refman/5.0/...e-trigger.html

Nov 13 '06 #2

P: n/a
Is a very good idea but i think that somebody or something must fire
this event . . . Is it posible to be start by it self ? ? ?

For example i like to meka a table like this :

$col_a | col_b | col_. . . | col_n | col_expire_date

When the expire date is the current date delete the record.

Thanks a lot . . . :D

Nov 14 '06 #3

P: n/a
I would drop it in to a function call that you can embed in other
functions that will get called on a regular basis. E.g. when a new
user registers, as well as creating all of the information required for
recording that user in the database it should call housekeeping()

This way the functions will run on a regular basis.

Obiron

Nov 14 '06 #4

P: n/a
me***********@gmail.com wrote:
Is a very good idea but i think that somebody or something must fire
this event . . . Is it posible to be start by it self ? ? ?

For example i like to meka a table like this :

$col_a | col_b | col_. . . | col_n | col_expire_date

When the expire date is the current date delete the record.

Thanks a lot . . . :D
Just set up a cron job to run once a day and deletes anything with an
expiration date of today or before.

It's one of the things cron jobs are designed for!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 14 '06 #5

P: n/a
Can you use temporary tables to store your data that is going to
expire? If so these tables are good for the life of the connection and
may be useful for what you are doing with your records that expire. You
can even create one that is just like one of your "real" table:

create temporary table IF NOT EXISTS tmpMyTableCopy LIKE tblMyTable

Jerry Stuckle wrote:
me***********@gmail.com wrote:
Is a very good idea but i think that somebody or something must fire
this event . . . Is it posible to be start by it self ? ? ?

For example i like to meka a table like this :

$col_a | col_b | col_. . . | col_n | col_expire_date

When the expire date is the current date delete the record.

Thanks a lot . . . :D

Just set up a cron job to run once a day and deletes anything with an
expiration date of today or before.

It's one of the things cron jobs are designed for!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 14 '06 #6

P: n/a
mm*****@gmail.com wrote:
Jerry Stuckle wrote:
>>me***********@gmail.com wrote:
>>>Is a very good idea but i think that somebody or something must fire
this event . . . Is it posible to be start by it self ? ? ?

For example i like to meka a table like this :

$col_a | col_b | col_. . . | col_n | col_expire_date

When the expire date is the current date delete the record.

Thanks a lot . . . :D

Just set up a cron job to run once a day and deletes anything with an
expiration date of today or before.

It's one of the things cron jobs are designed for!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Can you use temporary tables to store your data that is going to
expire? If so these tables are good for the life of the connection and
may be useful for what you are doing with your records that expire. You
can even create one that is just like one of your "real" table:

create temporary table IF NOT EXISTS tmpMyTableCopy LIKE tblMyTable
(Top posting fixed)

The only problem with temporary tables is they go away at the end of the
connection. If he wants to use use them again, i.e. on a subsequent
page, they're gone.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 14 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.