zend update query

zend update query  using -'php,mysql,zend-framework,sql-update'

How to write below mysql query using zend syntax?

UPDATE core_user_transaction as t
JOIN core_user_transaction_therapy AS cuts ON cuts.tid=t.tid
JOIN therapy_booking AS tb ON cuts.conf_id = tb.conf_id
JOIN therapy_service_fees AS fees ON cuts.fee_id=fees.id
JOIN therapy_service_taxes AS tst ON fees.service_id=tst.service_id
JOIN core_tax AS ct ON ct.tax_id = tst.tax_id
SET t.tax=ROUND(t.fee*(ct.tax_value/100),2),
    t.amount = (ROUND(t.fee*(ct.tax_value/100),2)+t.fee)
WHERE tb.datetime >= '2015-10-01 00:00:00'
    AND t.state = 'PENDING'
    AND t.status ='ACTIVE'


asked Oct 19, 2015 by rajeevr642
0 votes

2 Answers

0 votes

Try this:

$adapter = new Zend\Db\Adapter\Adapter($driverConfig);
$sql = "YOUR_QUERY";
$statement = $adapter->query($sql);

Also please refer Zend\Db\Adapter

answered Oct 19, 2015 by mca.agarwal
0 votes

There is no possible with the 'update()' method provided by the Zend Db Adapter. You can however, run the query manually using the adapter. Something like:

    // $adapter is an instance of Zend_Db_Adapter
    $adapter->query(YOUR QUERY HERE);
answered Oct 19, 2015 by vijaygupta1980