| @@ 49-67 (lines=19) @@ | ||
| 46 | * @param null $fields |
|
| 47 | * @return mixed reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object, FALSE if failed |
|
| 48 | */ |
|
| 49 | public function get($id = null, $fields = null) |
|
| 50 | { |
|
| 51 | if ((int)$id > 0) { |
|
| 52 | $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
| 53 | if (!$result = $this->db->query($sql)) { |
|
| 54 | return false; |
|
| 55 | } |
|
| 56 | ||
| 57 | $numrows = $this->db->getRowsNum($result); |
|
| 58 | if (1 == $numrows) { |
|
| 59 | $answer = new Smartfaq\Answer(); |
|
| 60 | $answer->assignVars($this->db->fetchArray($result)); |
|
| 61 | ||
| 62 | return $answer; |
|
| 63 | } |
|
| 64 | } |
|
| 65 | ||
| 66 | return false; |
|
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * insert a new answer in the database |
|
| @@ 48-66 (lines=19) @@ | ||
| 45 | * @param int $id faqid of the user |
|
| 46 | * @return mixed reference to the {@link Smartfaq\Faq} object, FALSE if failed |
|
| 47 | */ |
|
| 48 | public function get($id) |
|
| 49 | { |
|
| 50 | if ((int)$id > 0) { |
|
| 51 | $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
| 52 | if (!$result = $this->db->query($sql)) { |
|
| 53 | return false; |
|
| 54 | } |
|
| 55 | ||
| 56 | $numrows = $this->db->getRowsNum($result); |
|
| 57 | if (1 == $numrows) { |
|
| 58 | $faq = new Smartfaq\Faq(); |
|
| 59 | $faq->assignVars($this->db->fetchArray($result)); |
|
| 60 | ||
| 61 | return $faq; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| 65 | return false; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * insert a new faq in the database |
|