Your IP : 216.73.216.48
<?php
class Answers {
private $_dbAdapter;
private $_table;
public function __construct() {
$this->_dbAdapter = new MySQL();
$this->_table = TABLE_PREFIX . 'answers';
}
public function addAnswer($questionID, $answer, $isTrue) {
$insert = $this->_dbAdapter->runQuery('INSERT INTO ' . $this->_table . '
(question_id,answer,is_true)
VALUES ("' . $questionID . '", "' . $answer . '", "' . $isTrue . '")');
return $this->_dbAdapter->getLastInsertedID();
}
public function getAnswer($whereClause = '') {
if ($whereClause != '') {
$select = $this->_dbAdapter->runQuery('SELECT * FROM ' . $this->_table . '
WHERE ' . $whereClause);
}
if ($this->_dbAdapter->countRows($select) > 0) {
return $this->_dbAdapter->fetchRows($select);
}
}
}