當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Answer::getAnswer方法代碼示例

本文整理匯總了PHP中Answer::getAnswer方法的典型用法代碼示例。如果您正苦於以下問題:PHP Answer::getAnswer方法的具體用法?PHP Answer::getAnswer怎麽用?PHP Answer::getAnswer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Answer的用法示例。


在下文中一共展示了Answer::getAnswer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: flush

 /**
  * 
  * @param Answer $answer
  * @return int id of the Answer inserted in base. False if it didn't work.
  */
 public static function flush($answer)
 {
     $answerId = $answer->getId();
     $answerVar = $answer->getAnswer();
     $answerDate = $answer->getAnswerDate();
     $likert = $answer->getLikert()->getId();
     $user = $answer->getUser()->getId();
     $question = $answer->getQuestion()->getId();
     if ($answerId > 0) {
         $sql = 'UPDATE answer a SET ' . 'a.answer = ?, ' . 'a.answer_date = ?, ' . 'a.LIKERT_id_likert = ?, ' . 'a.USER_id_user = ?, ' . 'a.QUESTION_id_question = ? ' . 'WHERE a.id_answer = ?';
         $params = array('ssiiii', &$answerVar, &$answerDate, &$likert, &$user, &$question, &$answerId);
     } else {
         $sql = 'INSERT INTO answer ' . '(answer, answer_date, LIKERT_id_likert, USER_id_user, QUESTION_id_question) ' . 'VALUES(?, ?, ?, ?, ?)';
         $params = array('ssiii', &$answerVar, &$answerDate, &$likert, &$user, &$question);
     }
     $idInsert = BaseSingleton::insertOrEdit($sql, $params);
     if ($idInsert !== false && $answerId > 0) {
         $idInsert = $answerId;
     }
     return $idInsert;
 }
開發者ID:Eurymone,項目名稱:Student-Exam-Report-System,代碼行數:26,代碼來源:AnswerDAL.php

示例2: Answer

 function test_update()
 {
     //Arrange
     $test_field = "Joe Update";
     $test_quest_id = 1;
     $test_answer = new Answer($test_field, $test_quest_id);
     $test_answer->save();
     //Act
     $new_answer = "Sam Update";
     $test_answer->update($new_answer);
     //Assert
     $this->assertEquals("Sam Update", $test_answer->getAnswer());
 }
開發者ID:umamiMike,項目名稱:promptr,代碼行數:13,代碼來源:AnswerTest.php


注:本文中的Answer::getAnswer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。