querying for values inside range

From: Date: Tue, 18 Mar 2003 11:04:57 +0000
Subject: querying for values inside range
Groups: php.general 
Request: Send a blank email to php-general+get-140103@lists.php.net to get a copy of this message
this is an sql syntax question and i know it's not appropriate for this mailing list, but i didn't want to subscribe to another mailing list for something i think one of you might be able help me with. thank you for your patience. i'm building a site utilizing PHP/MySQL. i'm querying a table to find records where a field lies within a certain range. $age1 = "20"; $age2 = "30"; $sql = "select * from table where age>=$age1 and age<=$age2"; is there another way to write this query? i'm going to be building the sql string programmatically and i was curious about different syntax being able to produce the same result in the hopes that it'll help streamline my PHP code. for example, what if i don't know which is value is greater, age1 or age2? is there some sql syntax that will deal with this situation without me having to determine which is which via PHP? _________________________________________________________________ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail

« previous php.general (#140103) next »