CodeIgniter Question: How to delete records using ActiveRecord with mySQL function as WHERE conditio
Posted
by Jhourlad Estrella
on Stack Overflow
See other posts from Stack Overflow
or by Jhourlad Estrella
Published on 2010-06-07T18:34:42Z
Indexed on
2010/06/08
23:02 UTC
Read the original article
Hit count: 218
I have a table named ChatSessions where I keep track of active users in the chatroom. I need to prune expired user sessions from the table every 10 minutes. Using pure php-mysql is plain simple but I'm totally clueless how to convert this into ActiveRecord in CodeIgniter. The plain SQL query is below:
SELECT *
FROM `ChatSessions`
WHERE `SessionExpires` < DATE_SUB( NOW( ) , INTERVAL 10 MINUTE )
Can anybody tell me what is the equivalent code in CodeIgniter using ActiveRecord?
Thanks in advanced.
© Stack Overflow or respective owner