/** * Insert data into the database. * * @param $table the selected table for the data to go into. See Types.php for a full list of available options * @param $data the data to be inserted, should be a vo from the vo/ directory */ public function insertData($table, $data) { include_once 'proxy/databaseProxy.php'; $proxy = new databaseProxy($this->registry); $this->newData = $data; $this->setupConnection(); $proxy->setTable($table); $proxy->insertRow($this->newData); }
/** * Updates data in one of the databases. * * @param $database the database needed to be updated - Types::PORTFOLIO Types::BLOG Types::SETTINGS * @param $section the table with the data in that needs to be updated. * @param $id the id of the row needed to be updated. */ public function updateData($table, $id, $paramsToUpdate, $updatedParamData) { $this->_table = $table; $this->_id = $id; $this->_paramsToUpdate = $paramsToUpdate; $this->_updatedParamData = $updatedParamData; $this->setupConnection(); /* * Load the proxy and get the data from the database. */ include_once 'proxy/databaseProxy.php'; $proxy = new databaseProxy($this->registry); $proxy->setTable($this->_table); if ($this->_id != null) { $data = $proxy->updateRowById($this->_id, $this->_paramsToUpdate, $this->_updatedParamData); } else { echo '<p>update.php updateData() - Please specify and ID!</p>'; } return $data; }
/** * The function deletes a row from a table in a selected database. * * @param $database the database the table is in with the row you want to delete. * @param $section the table to row is in you want deleted. * @param $id the id of the row you want deleted. */ public function deleteRow($table, $id) { $this->_table = $table; $this->_id = $id; $this->setupConnection(); include_once 'proxy/databaseProxy.php'; /* * Load the proxy and get the data from the database. */ $proxy = new databaseProxy($this->registry); /* * Set the table. See Types.php Line 38 onwards for full list. */ $proxy->setTable($this->_table); if ($this->_id != null) { $data = $proxy->deleteRowById($this->_id); } else { echo 'delete.php deleteRow() - Please specifiy an id!'; } return $data; }
public function getUploadPath() { $this->setupConnection(); include_once 'proxy/databaseProxy.php'; /* * Load the proxy and get the data from the database. */ $proxy = new databaseProxy($this->_registry); $proxy->setTable(Types::SETTINGS_TABLE); $data = $proxy->getRows(); while ($row = mysql_fetch_array($data)) { $uploadPath = $row['uploadPath']; } return $uploadPath; }