Re: Filter a query result

From: Date: Fri, 10 Nov 2000 00:00:28 +0000
Subject: Re: Filter a query result
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24581@lists.php.net to get a copy of this message
In article <3.0.2.32.20001109083142.00947470@facstaff.wisc.edu>, bcoulter@facstaff.wisc.edu ("Brian L. Coulter") wrote: > I have a query where I search for data between two dates: > > $query="Select Day,Faculty,Location from faculty where Day BETWEEN {d > $today} and {d $later}" > $result=odbc_exec($connect,$query); > > Now I want to filter the $result by Day or Location. > > I was able to do this in ASP using vbscript, then reset the filter to null > to get back the whole query result, but haven't found anything similar in > PHP4. I dunno how that ASP filtering stuff worked, but here are two options, depending on what you are trying to do. #1. Let the *database* filter it. The database engine has been highly optimized to filter data, and the general rule is: "If you can do it in SQL, you should" #2. Search for an odbc_dataseek() or similarly named function, and iterate through the result set several times, skipping any records you don't want. -- Richard Lynch | If this was worth $$$ to you, buy a CD US Customer Support Director | from one of the artists listed here: Zend Technologies USA | http://www.L-I-E.com/artists.htm http://www.zend.com | (this has nothing to do with Zend, duh!)

« previous php.general (#24581) next »