Solution to: Zend Form Error: String was not found in the haystack Ok So you submit your form with everthing correctly entered and bang…String was not found in the haystack. What does this mean? Well this is actually the best defence of CSFR – Request Forgery that Zend has. This is basically tampering with the $_POST variable […]
Category: Zend Framework 1.12
Tutorial on how to go back to previous page Zend Framework Controller: $request = $this->getRequest(); $referrer = $request->getHeader(‘referer’); $this->view->referer = $referer; View:
public function getCount() { $select = $this->select(); $select->from($this, array(‘count(*) as amount’)); $rows = $this->fetchAll($select); return($rows[0]->amount); }
How to Execute a straight SQL query without the hassle of a model. #application/controlers/MyController.php I assume the Database is setup in the config file, Application.ini. $dbAdapter = Zend_Db_Table::getDefaultAdapter(); $sql =’SELECT * FROM users WHERE id > 23′; $statement = $dbAdapter->query($sql); $row = $statement->fetch(); if ($arr[‘id’] == 45) $this->view->response = ‘yes’; else $this->view->response = ‘no’; If […]
It’s a New Year That means Instead of Saying 2014 on the bottom of your website it says 2014. copyright (c) 2013 Mysite.co.za Well here’s how to make that line dynamic so you need not change it again Zend: <?php $date = new Zend_Date(); echo $date->get(Zend_Date::YEAR); ?> PHP: echo date(“Y”);