<!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=526393818-20082010><FONT color=#0000ff size=2 face=Arial>Thanks 
Dan!, with a few more adjustments, the biggest changing the implode from OR to 
AND, it appears to be working.&nbsp; Thanks very much.</FONT></SPAN></DIV>
<DIV><SPAN class=526393818-20082010><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=526393818-20082010><FONT color=#0000ff size=2 
face=Arial>jim</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 5:54 
  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>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: 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 &lt;jim.dahl@mail.co.douglas.mn.us&gt;<BR><B><SPAN 
    style="FONT-WEIGHT: bold">To:</SPAN></B> Dan Little 
    &lt;danlittle@yahoo.com&gt;; 
    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.&nbsp; I had to take out a curly 
    bracket }&nbsp;and a dollar sign $ to make it not error out but search came 
    back empty.&nbsp; 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>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 
    face=Arial>&lt;?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>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 face=Arial>if 
    ($field &lt;&gt; "none") {<BR>&nbsp;&nbsp;// Microsoft Access connection 
    string.<BR>&nbsp;&nbsp;// Douglas server<BR>&nbsp;&nbsp;//$db = 
    '\\ms4w\\apps\\GeoMOOSE\\douglas\\maps_douglas\\database\\parcels.mdb';<BR>&nbsp;&nbsp;// 
    HEI server<BR>&nbsp;&nbsp;$db = 
    '\\ms4w\\apps\\GeoMOOSE\\douglas\\maps_douglas\\database\\aex.mdb';</FONT></SPAN></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 
    face=Arial>&nbsp;&nbsp;$conn = new COM('ADODB.Connection'); // or 
    exit('Cannot start ADO.');</FONT></SPAN></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 
    face=Arial>&nbsp;&nbsp;// Two ways to connect. Choose 
    one.<BR>&nbsp;&nbsp;$conn-&gt;Open("Provider=Microsoft.Jet.OLEDB.4.0; Data 
    Source=$db"); // or exit('Cannot open with 
    Jet.');<BR>&nbsp;&nbsp;//$conn-&gt;Open("DRIVER={Microsoft Access Driver 
    (*.mdb)}; DBQ=$db"); // or exit('Cannot open with 
    driver.');</FONT></SPAN></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 
    face=Arial>&nbsp;&nbsp;// SQL statement to build 
    recordset.<BR>&nbsp;&nbsp;if ($field == "TRS" || $field2 == "DOCTYPE") 
    {<BR>&nbsp;&nbsp;&nbsp; $rs = $conn-&gt;Execute("SELECT * FROM 
    Surveyor_Image_Link WHERE TRS LIKE '%".$searchval."%' ORDER BY ".$sort." 
    ASC");<BR>//&nbsp;&nbsp;&nbsp; ||<BR>//&nbsp;&nbsp;) elseif ($field2 == 
    "DOCTYPE") {<BR>//&nbsp;&nbsp;&nbsp; $rs = $conn-&gt;Execute("SELECT * FROM 
    Surveyor_Image_Link WHERE DOCTYPE LIKE '".$searchval2."%' ORDER BY ".$sort." 
    ASC");<BR>&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp; echo "You have reached 
    this page by mistake.";<BR>&nbsp;&nbsp;}</FONT></SPAN></DIV>
    <DIV>&nbsp;</DIV>
    <DIV><SPAN class=734050120-19082010><FONT color=#0000ff size=2 
    face=Arial><BR>}<BR>?&gt;</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>&nbsp;array_push($clauses, "TRS like '%".$searchval$."%'");</DIV>
      <DIV>}</DIV>
      <DIV>if($field2 == "DOCTYPE") {</DIV>
      <DIV>&nbsp;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>&nbsp;$rs = $conn-&gt;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 &lt;jim.dahl@mail.co.douglas.mn.us&gt;<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.&nbsp; I can make each field 
        search correctly by themselves but not together.&nbsp; 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.&nbsp; 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>&nbsp;</DIV>
        <DIV><FONT size=2 face=Arial><SPAN 
        class=463185014-19082010>&nbsp;&nbsp;if ($field == "TRS") 
        {<BR>&nbsp;&nbsp;&nbsp; $rs = $conn-&gt;Execute("SELECT * FROM 
        Surveyor_Image_Link WHERE TRS LIKE '%".$searchval."%' ORDER BY ".$sort." 
        ASC");<BR>//&nbsp;&nbsp;) if ($field2 == "DOCTYPE") 
        {<BR>//&nbsp;&nbsp;&nbsp; $rs = $conn-&gt;Execute("SELECT * FROM 
        Surveyor_Image_Link WHERE DOCTYPE LIKE '".$searchval2."%' ORDER BY 
        ".$sort." ASC");<BR>&nbsp;&nbsp;} else {<BR>&nbsp;&nbsp;&nbsp; echo "You 
        have reached this page by 
        mistake.";<BR>&nbsp;&nbsp;}<BR></SPAN></FONT></DIV>
        <DIV>&nbsp;</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>&nbsp;&nbsp; 
        320-762-2999<BR>F 320-762-2998</FONT></P></DIV>
        <DIV>&nbsp;</DIV></DIV></DIV></BLOCKQUOTE>
      <DIV></DIV></DIV><BR></BLOCKQUOTE></DIV></DIV></BLOCKQUOTE>
  <DIV style="POSITION: fixed"></DIV></DIV><BR></BLOCKQUOTE></BODY></HTML>