Например, вы можете хранить их в массиве.Что-то вроде:
$options = array('option1', 'option2', 'etc');
$sql = 'SELECT * FROM table WHERE ' . implode(' AND ', $options);
Вы можете даже составить весь запрос с массивом, в зависимости от того, что вам нужно изменить (я имею в виду, только сделать то, что вам нужно изменить, можно настроить).Например:
$query = array(
'select' => 'SELECT *',
'from' => 'FROM table',
'where' => 'WHERE',
'conditions' => array('a = 2', '(b = 3) OR (c = 4)'));
/* ... */
if ($something_happens_that_needs_to_change_the_table) {
$query['from'] = 'FROM another_table';
}
/* ... other things that need to change the query somehow ... */
$query['conditions'] = implode(' AND ', $query['conditions']);
$query_to_count = $query;
$query_to_count['select'] = 'SELECT COUNT(*) AS total';
$query_to_count = implode(' ', $query_to_count);
$query = implode(' ', $query);