| @@ 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 |
|
| @@ 430-448 (lines=19) @@ | ||
| 427 | * @param null $fields |
|
| 428 | * @return mixed reference to the <a href='psi_element://sfAnswer'>sfAnswer</a> object, FALSE if failed |
|
| 429 | */ |
|
| 430 | public function get($id = null, $fields = null) |
|
| 431 | { |
|
| 432 | if ((int)$id > 0) { |
|
| 433 | $sql = 'SELECT * FROM ' . $this->db->prefix('smartfaq_answers') . ' WHERE answerid=' . $id; |
|
| 434 | if (!$result = $this->db->query($sql)) { |
|
| 435 | return false; |
|
| 436 | } |
|
| 437 | ||
| 438 | $numrows = $this->db->getRowsNum($result); |
|
| 439 | if ($numrows == 1) { |
|
| 440 | $answer = new sfAnswer(); |
|
| 441 | $answer->assignVars($this->db->fetchArray($result)); |
|
| 442 | ||
| 443 | return $answer; |
|
| 444 | } |
|
| 445 | } |
|
| 446 | ||
| 447 | return false; |
|
| 448 | } |
|
| 449 | ||
| 450 | /** |
|
| 451 | * insert a new answer in the database |
|