Automatically Deleting Records
Posted 03 April 2006 - 08:39 PM
Posted 03 April 2006 - 10:06 PM
You might also consider just keeping the data. You can use MySQL's date math to ignore old data during page loads. Just add a "WHERE datecolumn > NOW() - INTERVAL 1 MONTH" to your queries, and put an index on datecolumn. There won't be a big performance hit this way. You may still want to go the delete route if the old data uses up an unusually large amount of space.
Posted 04 April 2006 - 02:48 AM
$postdate = time() - 2592000;
$timestampquery = mysql_query("DELETE FROM tablename WHERE dateadded < '$postdate'") or trigger_error('Error deleting records older than 30 days\r\n'.mysql_error(), E_USER_ERROR);
is that what you usually do?
Posted 04 April 2006 - 03:55 AM
Posted 04 April 2006 - 04:35 AM
Posted 05 April 2006 - 06:56 AM
As far as images go, I'm weary of having a DB act like a filesystem for anything other than the simplest image storage system. That is, if each user can upload their own photo, then sure, make a new table call user_photos, and you're done. But if the app the DB is supporting is based on image uploads, then just store the file path and be done with it.
Posted 05 April 2006 - 03:29 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users