RE: [PHP] sqlite AND OR query ?

From: Date: Wed, 09 May 2007 13:15:55 +0000
Subject: RE: [PHP] sqlite AND OR query ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254640@lists.php.net to get a copy of this message
chris@aquanuke.com wrote: > Hello, > > I want to select two dates one being todays date and the > other being 0000-00-00 which just a date in the database when > no proper date has been entered. > > Ive tried this but it does not work... > > $today = date('Y-m-d'); > $result = sqlite_query($db, "SELECT * FROM domains WHERE date = > '0000-00-00' AND '$today'"); > > I just get items with '0000-00-00' returned or if I reverse it ie... > > WHERE date = '$today'AND '0000-00-00'"); > > I just get $today items returned. > > I also tried using OR instead of AND ie... > > WHERE date = '0000-00-00' OR '$today'"); > > But that seems to be returning all items in the db. > > > Thanks. SELECT * FROM domains WHERE (date = '0000-00-00' OR date = '$today') -B

« previous php.general (#254640) next »