title: How to write 'WHERE' clause condition with AND in joomla 1.7? I have no data save for update
body: <p>Please suggest how to write the following <code>UPDATE</code> query with <code>AND</code> in joomla.</p>
  
  <p>Code:</p>
  
  <pre><code>$query = JFactory::getDbo()-&gt;getQuery(true);
  $db =&amp; JFactory::getDBO();
  $query-&gt;update('table1');
  $query-&gt;set('id = ' . $db-&gt;quote($idname));
  $query-&gt;set ('day='. $db-&gt;quote($this-&gt;_day));
  $query-&gt;set('id2 = ' . $id2);
  
  $query-&gt;where('id = '. (int)$idname)
          AND('id2=' .(int)$id2 );
  </code></pre>
  
  <p>The update is unsuccessful and the error is something like this:</p>
  
  <pre><code>//........[something before ]....
  
  array(3) {
      [0]=&gt;
      string(11) "id = '1'"
      [1]=&gt;
      string(14) "id2='2'"
      [2]=&gt;
      string(17) "date = 2012-04-02"    [it seems i got all the value pass to be update]
    }
    ["glue:protected"]=&gt;
    string(4) "
  , "
  }
  ["where:protected"]=&gt;
  object(JDatabaseQueryElement)#251 (3) {
    ["name:protected"]=&gt;
    string(5) "WHERE"
    ["elements:protected"]=&gt;
    array(1) {
      [0]=&gt;
      string(14) "id = 2"  [where clause is ok  ...BUT with AND...]
    }
    ["glue:protected"]=&gt;   
    string(5) " AND "
  }
  ["group:protected"]=&gt;  [something is wrong here...?]
  NULL
  ["having:protected"]=&gt;
  NULL
  ["columns:protected"]=&gt;
  NULL
  ["values:protected"]=&gt;
  NULL
  ["order:protected"]=&gt;
  NULL
  ["autoIncrementField:protected"]=&gt;
  NULL
  }
  </code></pre>