Class Varien_Db_Select

Description

Located in /Db/Select.php (line 2)

Zend_Db_Select
   |
   --Varien_Db_Select
Method Summary
Varien_Db_Select __construct ( $adapter)
Zend_Db_Select where (string $cond, [string $value = null], [constant $type = null])
Methods
Constructor __construct (line 9)

Class constructor

  • access: public
Varien_Db_Select __construct ( $adapter)
  • Zend_Db_Adapter_Abstract $adapter
where (line 46)

Adds a WHERE condition to the query by AND.

If a value is passed as the second param, it will be quoted and replaced into the condition wherever a question-mark appears. Array values are quoted and comma-separated.

  1.  // simplest but non-secure
  2.  $select->where("id = $id");
  3.  
  4.  // secure (ID is quoted but matched anyway)
  5.  $select->where('id = ?'$id);
  6.  
  7.  // alternatively, with named binding
  8.  $select->where('id = :id');

Note that it is more correct to use named bindings in your queries for values other than strings. When you use named bindings, don't forget to pass the values when actually making a query:

  1.  $db->fetchAll($selectarray('id' => 5));

  • return: This Zend_Db_Select object.
  • access: public
Zend_Db_Select where (string $cond, [string $value = null], [constant $type = null])
  • string $cond: The WHERE condition.
  • string $value: OPTIONAL A single value to quote into the condition.
  • constant $type: OPTIONAL The type of the given value

Documentation generated on Fri, 09 May 2008 04:36:28 +0300 by phpDocumentor 1.4.2