<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><div>Is this the old version of the script? It looks like it does not include the code suggestion I made.</div><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div style="font-family:arial, helvetica, sans-serif;font-size:10pt"><br><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><font size="2" face="Tahoma"><b><span style="font-weight: bold;">From:</span></b> Jim Dahl <jim.dahl@mail.co.douglas.mn.us><br><b><span style="font-weight: bold;">To:</span></b> Dan Little <danlittle@yahoo.com>; geomoose-users@lists.sourceforge.net<br><b><span style="font-weight: bold;">Sent:</span></b> Thu, August 19, 2010 3:02:23 PM<br><b><span style="font-weight: bold;">Subject:</span></b> RE: [Geomoose-users] Need help with ELSE / OR
statements<br></font><br>
<style type="text/css">DIV {
MARGIN:0px;}
</style>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial">Dan,
it must be getting close. I had to take out a curly bracket } and a
dollar sign $ to make it not error out but search came back empty. I will
include more script if that helps.</font></span></div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"></font></span> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"><?php<br>$field=(isset($_REQUEST['field']))?$_REQUEST['field']:"none";<br>$field2=(isset($_REQUEST['field2']))?$_REQUEST['field2']:"none";<br>$sort=(isset($_REQUEST['sort']))?$_REQUEST['sort']:"Surveyor_Image_Link.TRS";<br>//$sort2=(isset($_REQUEST['sort2']))?$_REQUEST['sort2']:"Surveyor_Image_Link.DOCTYPE";<br>$searchval=(isset($_REQUEST['searchval']))?$_REQUEST['searchval']:"none";<br>$searchval2=(isset($_REQUEST['searchval2']))?$_REQUEST['searchval2']:"none";</font></span></div>
<div> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial">if
($field <> "none") {<br> // Microsoft Access connection
string.<br> // Douglas server<br> //$db =
'\\ms4w\\apps\\GeoMOOSE\\douglas\\maps_douglas\\database\\parcels.mdb';<br> //
HEI server<br> $db =
'\\ms4w\\apps\\GeoMOOSE\\douglas\\maps_douglas\\database\\aex.mdb';</font></span></div>
<div> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"> $conn = new COM('ADODB.Connection'); // or exit('Cannot
start ADO.');</font></span></div>
<div> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"> // Two ways to connect. Choose
one.<br> $conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=$db"); // or exit('Cannot open with
Jet.');<br> //$conn->Open("DRIVER={Microsoft Access Driver
(*.mdb)}; DBQ=$db"); // or exit('Cannot open with driver.');</font></span></div>
<div> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"> // SQL statement to build recordset.<br> if
($field == "TRS" || $field2 == "DOCTYPE") {<br> $rs =
$conn->Execute("SELECT * FROM Surveyor_Image_Link WHERE TRS LIKE
'%".$searchval."%' ORDER BY ".$sort." ASC");<br>//
||<br>// ) elseif ($field2 == "DOCTYPE") {<br>//
$rs = $conn->Execute("SELECT * FROM Surveyor_Image_Link WHERE DOCTYPE LIKE
'".$searchval2."%' ORDER BY ".$sort." ASC");<br> } else
{<br> echo "You have reached this page by
mistake.";<br> }</font></span></div>
<div> </div>
<div><span class="734050120-19082010"><font color="#0000ff" size="2" face="Arial"><br>}<br>?></font></span></div>
<blockquote style="MARGIN-RIGHT:0px;">
<div></div>
<div dir="ltr" lang="en-us" class="OutlookMessageHeader" align="left"><font size="2" face="Tahoma">-----Original Message-----<br><b>From:</b> Dan Little
[mailto:danlittle@yahoo.com] <br><b>Sent:</b> Thursday, August 19, 2010 1:05
PM<br><b>To:</b> Jim Dahl;
geomoose-users@lists.sourceforge.net<br><b>Subject:</b> Re: [Geomoose-users]
Need help with ELSE / OR statements<br><br></font></div>
<div style="FONT-FAMILY:arial, helvetica, sans-serif;FONT-SIZE:10pt;">
<div>Good news, GM2.2 can do this! :) Bad news... GM1.6 is harder and you need
to use manual SQL.</div>
<div><br></div>
<div>$clauses = array();</div>
<div>if($field == "TRS") {</div>
<div> array_push($clauses, "TRS like '%".$searchval$."%'");</div>
<div>}</div>
<div>if($field2 == "DOCTYPE") {</div>
<div> array_push($clauses, "<span style="FONT-FAMILY:Arial;FONT-SIZE:small;" class="Apple-style-span">DOCTYPE
LIKE '".$searchval2."%'");</span></div>
<div><span style="FONT-FAMILY:Arial;FONT-SIZE:small;" class="Apple-style-span">}</span></div>
<div><span style="FONT-FAMILY:Arial;FONT-SIZE:small;" class="Apple-style-span">$all_clauses = implode(" or ", $clauses);</span></div>
<div><span style="FONT-FAMILY:Arial;FONT-SIZE:small;" class="Apple-style-span"><br></span></div>
<div><span style="FONT-FAMILY:Arial;FONT-SIZE:small;" class="Apple-style-span"> $rs = $conn->Execute("SELECT * FROM
Surveyor_Image_Link WHERE ".$all_clauses." ORDER BY ".$sort."
ASC");</span></div>
<blockquote style="BORDER-LEFT:rgb(16,16,255) 2px solid;PADDING-LEFT:5px;MARGIN-LEFT:5px;">
<div style="FONT-FAMILY:arial, helvetica, sans-serif;FONT-SIZE:10pt;"><br>
<div style="FONT-FAMILY:times new roman, new york, times, serif;FONT-SIZE:12pt;"><font size="2" face="Tahoma"><b><span style="FONT-WEIGHT:bold;">From:</span></b> Jim
Dahl <jim.dahl@mail.co.douglas.mn.us><br><b><span style="FONT-WEIGHT:bold;">To:</span></b>
geomoose-users@lists.sourceforge.net<br><b><span style="FONT-WEIGHT:bold;">Sent:</span></b> Thu, August 19, 2010 9:56:08
AM<br><b><span style="FONT-WEIGHT:bold;">Subject:</span></b>
[Geomoose-users] Need help with ELSE / OR statements<br></font><br>
<div><font size="2" face="Arial"><span class="463185014-19082010">I am trying to
add two search fields in my GM app. I can make each field search
correctly by themselves but not together. I have the code where the
first two lines work and when I comment out the first two and enable the
second two lines, the code works for searchval2. What I want to know
is how can I use ELSE with or without the OR statements to allow me to
enable both fields for the search?</span></font></div>
<div><font size="2" face="Arial"><span class="463185014-19082010"></span></font> </div>
<div><font size="2" face="Arial"><span class="463185014-19082010"> if
($field == "TRS") {<br> $rs = $conn->Execute("SELECT *
FROM Surveyor_Image_Link WHERE TRS LIKE '%".$searchval."%' ORDER BY
".$sort." ASC");<br>// ) if ($field2 == "DOCTYPE")
{<br>// $rs = $conn->Execute("SELECT * FROM
Surveyor_Image_Link WHERE DOCTYPE LIKE '".$searchval2."%' ORDER BY ".$sort."
ASC");<br> } else {<br> echo "You have reached
this page by mistake.";<br> }<br></span></font></div>
<div> </div>
<div align="left">
<p align="left"><font size="2" face="Arial">Jim Dahl, GISP<br>GIS
Coordinator<br>Douglas County Public Works<br>526 Willow Dr<br>PO Box
398<br>Alexandria MN 56308</font></p>
<p><font size="2" face="Arial">V 320-762-2933<br> 320-762-2999<br>F
320-762-2998</font></p></div>
<div> </div></div></div></blockquote>
<div style=""></div></div><br></blockquote>
</div></div></blockquote><div style="position:fixed"></div>
</div><br>
</body></html>