Reg Web Posted October 29, 2006 Share Posted October 29, 2006 Hi there!I am looking for a script which will enable me to tell the MySQL table to automatically delete a row upon a certain date and time.Is this possible? Link to comment https://forums.phpfreaks.com/topic/25474-expire-row-in-mysql-is-it-possible/ Share on other sites More sharing options...
paul2463 Posted October 29, 2006 Share Posted October 29, 2006 yesyou write a php script that will check over the database to delete all the rows you want it to such as:-code for deleteRows.php[code]<?php$connection = mysql_connect('localhost', '*****', '*****');mysql_select_db('table');$query = "DELETE FROM table WHERE "delete parameters are met";mysql_query($query)or die ('Error in query: $query. ' . mysql_error());?>[/code]then set up a cron job on your server to run the script when you want it running, once a day , once an hour or whatever Link to comment https://forums.phpfreaks.com/topic/25474-expire-row-in-mysql-is-it-possible/#findComment-116240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.