Posts Tagged ‘zf’

How to increase a database table column value in Zend Framework

Saturday, February 28th, 2009

... in a class extending Zend_Db_Table

$db = $this->getAdapter();
....
$db->update('table', array('views' => new <strong>Zend_Db_Expr</strong>("views + 1")), 'id = ' . $id);
....

How to extract id/numbers from the end of an URL using Javascript Regular Expressions (Regex)

Wednesday, February 11th, 2009

I was working with the Zend Framework and flowplayer and I needed to extract the ID from the url.
Here is the short JavaScript snippet.

var extr_id_regex = new RegExp('(\\d+)$', "gi");
var url = '/a/b/c/123';
var id = url.match(extr_id_regex);

if (id) {
alert(id);
}

Related