PHP Classes

Feature(s)

Recommend this page to a friend!

      SQL Query Builder  >  All threads  >  Feature(s)  >  (Un) Subscribe thread alerts  
Subject:Feature(s)
Summary:add multiple where options
Messages:1
Author:Emir Kurtovic
Date:2011-11-03 21:27:54
 

  1. Feature(s)   Reply   Report abuse  
Picture of Emir Kurtovic Emir Kurtovic - 2011-11-03 21:27:54
suggestion:

add
public function addWhere($where) {
if (!is_array($this->where))
$this->where = array();
$this->where[] = $where;
}

ad replace the where statement:
if ($this->where)
if (is_array($this->where))
$sqlString.="WHERE " . implode(' ', $where);
else
$sqlString.= " WHERE $this->where";

so you can use
$query->addWhere('id=1');
$query->addWhere('and `email` like '%@gmail.com%');
$query->addWhere( ...