Last active
August 29, 2015 14:09
-
-
Save phpdave/b069eecd98c36dbb1155 to your computer and use it in GitHub Desktop.
ZF1 Model column with a #
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Model | |
{ | |
protected $_dbh = null; | |
protected $_table = 'MYTABLE'; | |
public function __construct() | |
{ | |
$registry = Zend_Registry::getInstance(); | |
$this->_dbh = $registry->dbAdapter; | |
} | |
//CREATE | |
public function insert($data) | |
{ | |
$this->_dbh->insert($this->_table, $data); | |
} | |
//READ | |
public function fetchRowByCol($bind) | |
{ | |
return $this->_dbh->fetchRow("SELECT * FROM ".$this->_table." WHERE MYCOL# = ? ",$bind); | |
} | |
//UPDATE | |
public function update($data, $value) | |
{ | |
$where['MYCOL# = ?'] = $value; | |
return $this->_dbh->update($this->_table, $data, $where); | |
} | |
//DELETE | |
public function delete($value) | |
{ | |
$where['MYCOL# = ?'] = $value; | |
return $this->_dbh->update($this->_table, $where); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment