Skip to content

Instantly share code, notes, and snippets.

@shadowhand
Created June 19, 2009 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shadowhand/132868 to your computer and use it in GitHub Desktop.
Save shadowhand/132868 to your computer and use it in GitHub Desktop.
<?php
$query = DB::select()->from('users')
->where_open()
->where('username', '=', 'shadowhand')
->where_open()
->or_where('last_login', 'is', NULL)
->or_where('last_login', '<', strtotime('now -1 day'))
->where_close()
->and_where('id', '>', 1)
->where_close();
echo Kohana::debug((string) $query);
SELECT * FROM `users` WHERE (`username` = "shadowhand" AND (`last_login` IS NULL OR `last_login` < 1245357421) AND `id` > 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment