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



-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to