I have a custom GC Session method set that should delete any old sessions out of my database. Here is the func:
public function gc($max){
// Calculate what is to be deemed old
date_default_timezone_set('America/Chicago');
$old = time() - $max;
// Set query
$this->db->query('DELETE * FROM session WHERE access < :old');
// Bind data
$this->db->bind(':old', $old);
// Attempt execution
if($this->db->execute()){
// Return True
return true;
}
// Return False
return false;
}
The $max var represents the session.gc_maxlifetime
value in my php.ini. Here are the garbage collection settings in my .ini:
session.gc_probability = 1
session.gc_divisor = 100
session.gc_maxlifetime = 1440
However whenever this function runs, I always get the following Fatal Error:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM Sessions WHERE access < 1482965344' at line 1' in /Applications/MAMP/htdocs/demo/DB.php:66
Can't help but feel like I am missing something trivial...Any suggestions?