| @@ 390-408 (lines=19) @@ | ||
| 387 | * @param null $fields |
|
| 388 | * @return mixed reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object, FALSE if failed |
|
| 389 | */ |
|
| 390 | public function get($id = null, $fields = null) |
|
| 391 | { |
|
| 392 | if ((int)$id > 0) { |
|
| 393 | $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
| 394 | if (!$result = $this->db->query($sql)) { |
|
| 395 | return false; |
|
| 396 | } |
|
| 397 | ||
| 398 | $numrows = $this->db->getRowsNum($result); |
|
| 399 | if ($numrows == 1) { |
|
| 400 | $answer = new sfAnswer(); |
|
| 401 | $answer->assignVars($this->db->fetchArray($result)); |
|
| 402 | ||
| 403 | return $answer; |
|
| 404 | } |
|
| 405 | } |
|
| 406 | ||
| 407 | return false; |
|
| 408 | } |
|
| 409 | ||
| 410 | /** |
|
| 411 | * insert a new answer in the database |
|
| @@ 724-742 (lines=19) @@ | ||
| 721 | * @param int $id faqid of the user |
|
| 722 | * @return mixed reference to the {@link sfFaq} object, FALSE if failed |
|
| 723 | */ |
|
| 724 | public function & get($id) |
|
| 725 | { |
|
| 726 | if ((int)$id > 0) { |
|
| 727 | $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_faq') . ' WHERE faqid=' . $id; |
|
| 728 | if (!$result = $this->db->query($sql)) { |
|
| 729 | return false; |
|
| 730 | } |
|
| 731 | ||
| 732 | $numrows = $this->db->getRowsNum($result); |
|
| 733 | if ($numrows == 1) { |
|
| 734 | $faq = new sfFaq(); |
|
| 735 | $faq->assignVars($this->db->fetchArray($result)); |
|
| 736 | ||
| 737 | return $faq; |
|
| 738 | } |
|
| 739 | } |
|
| 740 | ||
| 741 | return false; |
|
| 742 | } |
|
| 743 | ||
| 744 | /** |
|
| 745 | * insert a new faq in the database |
|