<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.18939"></HEAD>
<BODY>
<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="POSITION: fixed"></DIV></DIV><BR></BLOCKQUOTE></BODY></HTML>