title: PDO PHP Adding "AND" in BetweenPlaceholders
body: <p>I would like to add " AND " in between the key and value pair arguments for my sql query but I don't know how. I have tried search the net but unable to find a solution.</p>
  
  <pre><code>       $cdatahome = fetchCategory(array("status"=&gt;"1","home"=&gt;"1")); 
  
         function fetchCategory(array $conditions){
          $db = Core::getInstance();
  
              $sql = "SELECT id, title FROM ruj_category WHERE ";
  
              $params = array();
              foreach ($conditions as $column =&gt; $value) {
              if (preg_match('/^[a-z-.]+$/', $column)) {
  
              $sql .= "$column = ?";
              $params[] = $value;
  
       }
      }           
              $sql .= " order by title asc";  
              $res = $db-&gt;dbh-&gt;prepare($sql);
              $res-&gt;execute(array_values($params));
                  $res = $res-&gt;fetchAll(PDO::FETCH_ASSOC);        
  
              return $res;
  </code></pre>