Categories
Zend Framework 1.12

Zend form Error: String was not found in the haystack

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 […]

Categories
Uncategorized Zend Framework 1.12

Go Back to Referring page Zend Framework

Tutorial on how to go back to previous page Zend Framework Controller: $request = $this->getRequest(); $referrer = $request->getHeader(‘referer’); $this->view->referer = $referer; View:

Categories
Zend Framework 1.12

How to use count(*) in Zend Select Statement

public function getCount() { $select = $this->select(); $select->from($this, array(‘count(*) as amount’)); $rows = $this->fetchAll($select); return($rows[0]->amount); }

Categories
Zend Framework 1.12

Zend Executing a straight SQL query without a Model

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 […]

Categories
PHP 5 Zend Framework 1.12

New Year, New Dates on your Copyright Footer of your Website

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”);