当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::update方法代码示例

本文整理汇总了PHP中Question::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::update方法的具体用法?PHP Question::update怎么用?PHP Question::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


在下文中一共展示了Question::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addAnswer

function addAnswer()
{
    $question = new Question($_POST);
    if ($question1 = Question::getAnswerByUserId($_SESSION['userId'], $question->question)) {
        $question->id = $question1->id;
        $question->update();
    } else {
        $question->insert();
    }
    header('main.php?action = login');
}
开发者ID:naval777,项目名称:Websites,代码行数:11,代码来源:main.php

示例2: Question

 function test_update()
 {
     //Arrange
     $test_field = "What is their name?";
     $test_description = "What you want to call your character.";
     $test_question = new Question($test_field, $test_description);
     $test_question->save();
     $new_quest = "How tall are they?";
     $new_desc = "The height you want your character to be.";
     //Act
     $test_question->update($new_quest, $new_desc);
     //Assert
     $this->assertEquals(["How tall are they?", "The height you want your character to be."], [$test_question->getQuestion(), $test_question->getDescription()]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:14,代码来源:QuestionTest.php

示例3: connectToEncryptedMySQL

<?php

require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "question.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/jfindley2.ini");
$question = new Question(null, 1, 2, "Huh?", null);
$question->insert($pdo);
$question->setQuestionText("What?");
$question->update($pdo);
$question->delete($pdo);
开发者ID:jfindley2,项目名称:amazon-product,代码行数:10,代码来源:question-shakedown.php

示例4: init

 function init()
 {
     $question = new Question();
     $func = array_shift($this->param);
     if (is_numeric($func)) {
         $this->id = $func;
     } else {
         if ($func != '') {
             $_SERVER['REQUEST_METHOD'] = 'POST';
             $course_id = array_shift($this->param);
             Security::checkEditor($course_id);
             switch ($func) {
                 case 'save':
                     $data['course_id'] = $course_id;
                     $data['type_id'] = $_POST['type_id'];
                     $data['data'] = $_POST['data'];
                     $data['count'] = $_POST['count'];
                     $data['answer'] = $_POST['answer'];
                     $id = $_POST['id'];
                     try {
                         $question->update($id, $data);
                     } catch (Exception $e) {
                     }
                     header('Location: /admin_questions/' . $data['course_id']);
                     exit;
                     break;
                 case 'delete':
                     try {
                         $question_id = array_shift($this->param);
                         $question->delete($question_id);
                         echo "ok";
                     } catch (Exception $e) {
                         echo $e;
                     }
                     header('Location: /admin_questions/' . $course_id);
                     exit;
                     break;
                 case 'find':
                     try {
                         $data = array('course_id' => $course_id, 'type_id' => 0, 'data' => '', 'answer' => '');
                         $q_id = $question->add($data);
                         $data['id'] = $q_id;
                         echo json_encode($data);
                     } catch (Exception $e) {
                         echo $e;
                     }
                     exit;
                     break;
                 case 'load':
                     try {
                         $question_id = array_shift($this->param);
                         $data = $question->get(array('course_id' => $course_id, 'id' => $question_id));
                         echo json_encode($data);
                     } catch (Exception $e) {
                         echo $e;
                     }
                     exit;
                     break;
                 default:
             }
         } else {
             header('Location: /404');
             exit;
         }
     }
 }
开发者ID:jedaika,项目名称:Trainings,代码行数:66,代码来源:admin_questions.php


注:本文中的Question::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。