Jump to content

Time


unidox

Recommended Posts

If you store timestamps its realy easy.

 

$user  ="mysql username";
$pass  ="mysql password";
$dbhost  ="mysql server address";
$dbname  ="mysql db name";

$link = mysql_connect($dbhost, $user, $pass);
if (!$link) {
   die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
    die ('Can\'t use ".$dbname." : ' . mysql_error());
}

$expire_time = time()-1800; /get time and - 30min * 60sec
$query = "DELETE FROM `table name` WHERE `time row` < ".$expire_time;
$result = mysql_query($query);

Link to comment
https://forums.phpfreaks.com/topic/180442-time/#findComment-952584
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.