Categories
PHP 5

PHP short of statement (Ternanry)

More info can be found at davidwalsh $message = ‘Hello ‘.($user->is_logged_in() ? $user->get(‘first_name’) : ‘Guest’);

Categories
SQL

PHP MySQL Query based on number of results returned

$sql = “SELECT * FROM tbl”; $result = mysql_query($sql); if (mysql_num_rows($result)==0) { //do this } else { //do that }

Categories
Uncategorized

Returning the Last Insert Id Zend Framework

return $row->save();

Categories
Uncategorized

Zend Database Expression for Mysql PASSWORD()

$db = Zend_Db_Table::getDefaultAdapter(); new Zend_Db_Expr($db->quoteInto(‘PASSWORD(?)’, $data[‘password’]))

Categories
Zend Framework 1.12

Disable Layout and View Zend Framework

Disable Layout and View Zend Often when actions are used in controllers that do some work but do not actually show the user anything, we need to disable layout and view Zend. This is helpful specifically with the use in Ajax (Aynchronous communication with the server). Disable Layout $this->_helper->layout()->disableLayout(); Disbale View $this->_helper->viewRenderer->setNoRender();