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


PHP Answer::loadCorrect方法代碼示例

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


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

示例1: __construct

 function __construct($questionNum)
 {
     $this->allAnswers = array();
     $this->correctAns = Answer::loadCorrect($questionNum);
     global $conn;
     $sql = "SELECT * FROM `answers` WHERE game_id ='" . $_SESSION["game_id"] . "' AND questionNum='" . $_SESSION["questionNumber"] . "' order by submitTime DESC";
     //echo $sql;
     $result = $conn->query($sql);
     if ($result) {
         while ($row = $result->fetch_assoc()) {
             $lat1 = $row["lat"];
             $long1 = $row["longg"];
             $ans = $row["answer"];
             $user_id = $row["user_id"];
             $qID = $row["id"];
             $points = $row["points"];
             if ($points == null) {
                 $points = 0;
             }
             $color = $row["color"];
             $this->allAnswers[$user_id] = Answer::addUser($qID, new LatLong($lat1, $long1), $ans, $user_id, $this->correctAns, $points, $color);
             //$submitTime= $row["submitTime"];
             //$miles=round(LatLong::distance($lat,$long,$lat1,$long1,"M"));
             //echo "<bR>user: ".getUserName($user_id) . " was : ".$miles ." miles away.  Submitted at time " . $submitTime ;
         }
     }
     $this->awardPoints();
     //Question::alertUsers("-1");
     //echo "loc is ".$this->correctAns->location->lat;
 }
開發者ID:theborland,項目名稱:myhoot,代碼行數:30,代碼來源:Answer.php

示例2: session_start

session_start();
$whitelist = array('lat', 'long', 'answer', 'questionNumber');
require '../controller/dbsettings.php';
if ($lat == "") {
    $lat = 0;
}
if ($long == "") {
    $long = 0;
}
$color = User::getColor();
//die ($color);
if ($_SESSION["user_id"] == 0) {
    die("Sorry this shouldnt happen - tell me about it...");
}
$correct = Answer::loadCorrect($questionNumber);
//place currently is true or false if they could submit (meaning 1st time)
//die ($questionNumber);
//echo $sql;
//die();
$game = Game::findGame();
if ($game->type == "geo" || $game->type == "places" || $game->type == "pt") {
    $distanceAway = LatLong::findDistance($correct->location, new LatLong($lat, $long));
} else {
    $distanceAway = abs($answer - $correct->value);
}
if ($answer > 100000) {
    $distanceAway = round($distanceAway, -5);
}
//die ($questionNumber);
$questionNumberSite = $game->round;
開發者ID:theborland,項目名稱:myhoot,代碼行數:30,代碼來源:submitAnswer.php


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