Todd came in with a good suggestion which I had started towards, so this is
what I have arrived at for the moment. I will be looking to make this more
elegant soon, but since they are screaming for the report now this is what I
did;
<?php
if($usoc1 <> "--- Select ---"){
$usoc[] = $usoc1;
}
if($usoc2 <> "--- Select ---"){
$usoc[] = $usoc2;
}
if($usoc3 <> "--- Select ---"){
$usoc[] = $usoc3;
}
if($usoc4 <> "--- Select ---"){
$usoc[] = $usoc4;
}
$usoc_count = count($usoc);
// query details
$qpon = "SELECT BillDate, StateInd, BAN, Type, PON, Phrase, PhraseLine1,
USOC, Description, RateZone, Rate ";
$qpon .= "FROM tblUSOCChargesDetail WHERE ";
$first = 0;
for($i = 0; $i < $usoc_count; $i++){
if($first == 0){
$qpon .= "USOC = '" . $usoc[$i] . "' ";
$first = 1;
} else {
$qpon .= "AND USOC = '" . $usoc[$i] . "' ";
}
}
$qpon .= "ORDER BY BillDate ";
if(!($dbpon = mysql_query($qpon, $dbconnect))){
print("MySQL reports: " . mysql_error() . "\n");
exit();
}
?>
I am sure that there is a more elegant solution, if I find it I will let you
know.
Thanks!
Jay
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php