2009年10月29日星期四

Re: [fw-db] How to assign typical Zend Db Query Object into Array

You can just do Zend_Json::encode($array); to encode and to decode just do Zend_Json::decode($json)

On Thu, Oct 29, 2009 at 6:08 AM, Nick Pack <nick@nickpack.com> wrote:
Enkhbilguun Erdenetsogt wrote:
Hello,

I'm learning Ajax with Zend Framework, and I just want to make my typical Zend Db Query Object (fetchAll()ed) to Json encoding ready array.

Can someone help me?

Thank you very much in advance.


Sincerely,

Enkhbilguun Erdenetsogt

You can do (in your controller):

$results = $table->fetchAll()->toArray();

$this->_helper->json($results);

Hope that helps




--
Shaun J. Farrell
Washington, DC
(202) 713-5241
www.farrelley.com

没有评论: