Ok , ive read up and found this
To convert a MySQL timestamp to a Unix-style timestamp, use MySQL's UNIX_TIMESTAMP function.
For Example:
$result=mysql_query ("SELECT UNIX_TIMESTAMP(timestamp_column) as epoch_time FROM table");
$unix_timestamp = mysql_result ($result, 0, 0);
This is my php script , which selects all my active user's , grabs the timestamp from the table colom , and checks it against the current time to see if they should be taken out of the active table.
But the MYSQL and PHP timestamps are different i cant compare the current time time() to the mysql stored time , so i gotta use the function above. But im clueless how to incorporate this into my current query.
$time = $date;
$ro = mysql_query("SELECT * FROM shocc_active");
$total = mysql_num_rows($ro);
// gets the time
$time = time();
// Makes sure the user is still active
while ($ru = mysql_fetch_array($ro)) {
$act = $ru['timestamp'] + 500 * 12;
$del = $ru['name'];
if (!$del) {
mysql_query("DELETE FROM `shocc_active` WHERE `name`='$del'");
}
if (strlen($del) <= 3) {
mysql_query("DELETE FROM `shocc_active` WHERE `name`='$del'");
}
if ($act < time()) {
mysql_query("DELETE FROM `shocc_active` WHERE `name`='$del'");
}
}
Any ideas on how i could do this?