<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><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 class="Apple-style-span" style="font-family: Arial; font-size: small; ">DOCTYPE LIKE '".$searchval2."%'");</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: small; ">}</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: small; ">$all_clauses = implode(" or ", $clauses);</span></div><div><span class="Apple-style-span" style="font-family: Arial; font-size: small; "><br></span></div><div><span
class="Apple-style-span" style="font-family: Arial; font-size: small; "> $rs = $conn->Execute("SELECT * FROM Surveyor_Image_Link WHERE ".$all_clauses." ORDER BY ".$sort." ASC");</span></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> 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="position:fixed"></div>
</div><br>
</body></html>