Hi all,
i am stucked with this. I have to transform regular sql into Zend DB sql and
then to return values in my phtml file. After many days i am not able to
acompish that. There is my indexAction.
public function indexAction() {
$db = Zend_Registry::get ( 'db' );
$sql = $db->select ()
->from ( 'bannertype', array ('bannertypeid', 'bannercat',
'bannercatdesc', 'active','bannersacross','view_type' ) )
->where ( 'active = ?', 'y' )->order ( 'bannertypeid','ASC' );
$rez = $sql->query ();
$i=-1;
while($res = $rez->fetchAll ()){
foreach($res as $key=>$value){
$i++;
//print_r($res);
$banncat= $res[$i]['bannertypeid'];
}
$this->view->bannerCategorie = $res;
$result = $db->fetchAll("SELECT ws.*,b.*,bt.*,
(SELECT COUNT(*) FROM banners b WHERE b.websiteid = ws.websiteid AND
b.bannertype= '$banncat') AS theCountCategory1,
(SELECT bannercat FROM bannertype c WHERE c.bannertypeid= '$banncat') AS
theNameCategory1
FROM websites ws left join banners b on b.websiteid=ws.websiteid
left join bannertype bt on b.bannertype=bt.bannertypeid where
b.bannertype='$banncat' group by ws.websiteid");
echo "<pre>";print_r($result);echo "</pre>";// this gives me an array
$this->view->result = $result;// this one returns nothing to phtml :(
}
}
How to pass this result into phtml?
Thank you,
V
--
View this message in context:
http://www.nabble.com/How-to-return-result-from-this-sql--tp20377930p20377930.html
Sent from the Zend Framework mailing list archive at Nabble.com.