当前位置: 首页>>代码示例>>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;未经允许,请勿转载。