[Geomoose-users] If statement not working with greater or less than
Jim Dahl
jim.dahl at mail.co.douglas.mn.us
Tue Aug 24 14:51:05 EDT 2010
This code works good without the commented out lines, it searches and
performs an AND subset of records. When I remove the // from 7 and 8,
the to and from work as they are should when only those fields are
entered. However, when any of the other fields are entered, there are
no results returned. I cannot figure out why the DATEFROM and DATETO
will not work with the other fields. Is the syntax for <= and >= look
ok?
$clauses = array();
if($field == "TRS") {
array_push($clauses, "TRS like '%".$searchval."%'");
}
if($field2 == "TR") {
array_push($clauses, "TR like '%".$searchval2."%'");
}
if($field3 == "TRS_ORIG") {
array_push($clauses, "TRS_ORIG like '%".$searchval3."%'");
}
if($field4 == "DOCTYPE") {
array_push($clauses, "DOCTYPE like '%".$searchval4."%'");
}
if($field5 == "CREATOR") {
array_push($clauses, "CREATOR like '%".$searchval5."%'");
}
if($field6 == "DATE") {
array_push($clauses, "DATE like '%".$searchval6."%'");
}
//if($field7 == "DATEFROM") {
// array_push($clauses, "DATEFROM >= '%".$searchval7."%'");
//}
//if($field8 == "DATETO") {
// array_push($clauses, "DATETO <= '%".$searchval8."%'");
//}
if($field9 == "YEAR") {
array_push($clauses, "YEAR like '%".$searchval9."%'");
}
$all_clauses = implode(" AND ", $clauses);
$rs = $conn->Execute("SELECT * FROM Surveyor_Image_Link WHERE
".$all_clauses." ORDER BY ".$sort." ASC");
Jim Dahl, GISP
GIS Coordinator
Douglas County Public Works
526 Willow Dr
PO Box 398
Alexandria MN 56308
V 320-762-2933
320-762-2999
F 320-762-2998
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20100824/2b8cee88/attachment.html
More information about the Geomoose-users
mailing list