本文整理汇总了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;
}
示例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;