CodeIgniter Forums
Delete Query from codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Delete Query from codeigniter (/thread-52292.html)



Delete Query from codeigniter - El Forum - 06-05-2012

[eluser]xtremer360[/eluser]
I'm trying to figure out how I need to do this query. I'm trying to delete all the users who have registered but not activated witin a certain time limit.

Code:
function purgeNA($expirePeriod)
{
    $this->db->where('usersStatusesID', 1);
    $this->db->where('UNIX_TIMESTAMP(registrationDate) <', time() - $expirePeriod);
    $this->db->delete($this->usersRegistrationsTable);
}

Here's my db structure:

Code:
usersRegistrationsTable - userID, registrationDate
usersTable              - userID, usersStatusesID