Sorry I should have stated the problem more precisely. Using Zend_DB_Table I
ran into two problems the first parameter the associative array of values, I
wanted to update the field by it's own value + 1 like
field = field + 1. The second parameter I need to add AND conditions to
narrow down the update. I'm un sure if the update method supports this at
this time the manual does mention "the second argument can be an array of
SQL expressions. The expressions are combined as Boolean terms using an AND
operator." If this is the case there's not much documentation describing how
to do this. Plus is there any way to do a comparison BETWEEN using either
the select or update methods?

// Is this allowed?
$data = array(
    'field' => 'field + 1',
);
// Need to add an AND or BETWEEN condition here.
$where = $table->getAdapter()->quoteInto('field_id = ?', $id);

$table->update($data, $where);

Thanks

Thomas Shaw
[email protected]

Always do whatever's next. 
George Carlin

-----Original Message-----
From: Simon Corless [mailto:[email protected]] 
Sent: Saturday, March 28, 2009 6:03 PM
To: [email protected]
Subject: Re: [fw-general] quoteInto() Question



Tom Shaw-4 wrote:
> 
> How do I use Zend_DB_Table to add multiple AND conditions using
> quoteInto().
> Ive tried several different methods and the only way I can do it is with a
> raw query string. Below are several examples that do not work. Example two
> somebody recommended and does not work, I can see the raw query using
> Zend_Profiler_Firebug it appends an extra AND condition when it's not
> needed.

Can't you use table select?

$table = new Bugs();

$select = $table->select();
$select->where('bug_status = ?', 'NEW')
       ->where('account_name = ?', 'Bob');

$rows = $table->fetchAll($select);

Explained on the manual page:
http://framework.zend.com/manual/en/zend.db.table.html (13.5.8. Querying for
a Set of Rows).

Adding multiple where clauses should, I believe (as it's based on
Zend_Db_Select), add AND to the clause.

Simon

-----
Simon

http://www.ajb007.co.uk/
-- 
View this message in context:
http://www.nabble.com/quoteInto%28%29-Question-tp22747185p22762371.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to