Skip to content

Instantly share code, notes, and snippets.

@bkmorse
Created February 28, 2014 16:25
Show Gist options
  • Select an option

  • Save bkmorse/9274056 to your computer and use it in GitHub Desktop.

Select an option

Save bkmorse/9274056 to your computer and use it in GitHub Desktop.
<?php
$search['cat_id'] = array(11, 12, 14);
$sql .= ' AND (' . implode(' OR c.cat_id = ', $search['cat_id']) . ')';
echo $sql;
// ( OR c.cat_id = 11 OR c.cat_id = 12 OR c.cat_id = 14)
// I don't want it to incude the first OR, so I want the final result to be: (c.cat_id = 11 OR c.cat_id = 12 OR c.cat_id = 14)
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment