title: Magento: How to search programmatically in customer collection
body: <p>I'm trying to build a search script to retrieve entries from customer collection. The trick is that the normal "OR" condition works only for the first entry.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>$customers = Mage::getResourceModel('customer/customer_collection')
          -&gt;addAttributeToSelect('*');
  
      if($_searchTerm = $this-&gt;getRequest()-&gt;getParam('q')){
          $customers-&gt;addAttributeToFilter(
              array(
                  array('attribute' =&gt; 'firstname', 'like' =&gt; $_searchTerm),
                  array('attribute' =&gt; 'lastname', 'like' =&gt; $_searchTerm),
                  array('attribute' =&gt; 'email', 'like' =&gt; '%' . $_searchTerm . '%'),
                  array('attribute' =&gt; 'phone', 'like' =&gt; '%' . $_searchTerm . '%'), /* valid field in my collection*/
              )
          );
      }
  </code></pre>
  
  <p>I've tried with wildcard "%" also but still no proper result.
  Most likely i'm missing something here.</p>
  
  <p>Thanks.</p>