Studyon Minte9.com
ZF 1.0

Study

Quoteinto



DOESN'T WORK

$users = new Users();
$sql = 'SELECT * FROM users WHERE enabled = ? AND country = ?';
$sql = $users->getAdapter()->quoteInto($sql, 1);
$sql = $users->getAdapter()->quoteInto($sql, 'UK');

THIS WORKS

$sql = 'INSERT INTO catg_path (ancestor, descendant, depth) VALUES(?, ?, 0)';
$sql = $this->getAdapter()->quoteInto($sql, $insert_id);

SOLUTION (quote)

$sql = "
    UPDATE catg 
    SET status = {$this->getAdapter()->quote($status)}
    WHERE id IN (SELECT descendant FROM catg_path WHERE ancestor = {$this->getAdapter()->quote($ancestor)})
    ";


UPDATE (Zend_Db_Table)

$data = array('status' => $this->getStatus());
$where = $this->getAdapter()->quoteInto('id = ?', $this->getId());
$this->update($data, $where);   

DELETE (Zend_Db_Table)

$this->delete( $this->getAdapter()->quoteInto('id = ?', $this->getId()) );


http://codeaid.net/search/quoteinto
http://tech.amikelive.com/node-5/modifying-zend_db_adapter_abstractquoteinto-to-accept-multiple-question-marks/