本文整理汇总了PHP中getQuestions函数的典型用法代码示例。如果您正苦于以下问题:PHP getQuestions函数的具体用法?PHP getQuestions怎么用?PHP getQuestions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getQuestions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getQuestion
function getQuestion($id)
{
$qsts = getQuestions();
foreach ($qsts as $q) {
if ($q["id"] == $id) {
return $q;
}
}
return null;
}
开发者ID:ConcertUrbain,项目名称:handicap,代码行数:10,代码来源:api_handicap.php
示例2: getQuestions
function getQuestions($pollid, $parentid = 0, $depth = 0)
{
global $db;
$parents = $db->selectList('detailedpoll_questions', '*', "`parentid`=" . $parentid . " AND `detailedpollid` = " . (int) $pollid, "`rank` ASC");
if ($parents) {
$newparents = array();
foreach ($parents as $parent) {
$childs = getQuestions($pollid, $parent['questionid'], $depth + 1);
$parent['depth'] = $depth;
$parent['childs'] = $childs ? count($childs) : 0;
$newparents[] = $parent;
if ($childs) {
$newparents = array_merge($newparents, $childs);
}
}
return $newparents;
} else {
return false;
}
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:20,代码来源:detailedpoll.function.php
示例3: doAction
function doAction($action)
{
$forwardpage = "";
$forward = true;
$loggedin = isUserLoggedIn();
if (!$loggedin && strcmp($action, "login") != 0 && strcmp($action, "register") != 0 && strcmp($action, "getTags") != 0) {
addError("fatal", "user.unathorized");
outputJSON("error");
} else {
if (strcmp($action, "login") == 0) {
login();
} else {
if (strcmp($action, "logout") == 0) {
logout();
} else {
if (strcmp($action, "isLoggedIn") == 0) {
isLoggedIn();
} else {
if (strcmp($action, "register") == 0) {
register();
} else {
if (strcmp($action, "addquestion") == 0) {
addQuestion();
} else {
if (strcmp($action, "getTags") == 0) {
getTags();
} else {
if (strcmp($action, "getquestions") == 0) {
getQuestions();
}
}
}
}
}
}
}
}
}
开发者ID:nithin001,项目名称:catcracker,代码行数:38,代码来源:controller.php
示例4: getQuestions
include "includes.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>Conseil general - Titre du site</title>
<?php
include "head.php";
?>
<link rel="stylesheet" type="text/css" href="styles/mosaic.css?v=1"></link>
<script src="js/mosaic.js?v=1" type="text/javascript"></script>
</head>
<body><div class="all" id="all-global"><?php
//ORDRE DES ELEMENTS EST IMPORTANT
if (strlen($cat) < 1) {
$qsts = getQuestions();
if (count($qsts) < 1) {
die("Pas de questions");
}
$question = getCurrentQuestion();
$qstId = $question["id"];
include "mosaicContent.php";
} else {
if (strpos($cat, "presentation") > -1) {
list($cat, $subcat) = explode("-", $cat);
include "presentation.php";
} else {
include $cat . ".php";
}
}
?>
开发者ID:ConcertUrbain,项目名称:handicap,代码行数:31,代码来源:mosaic.php
示例5: json_decode
<?php
require_once "feeder.php";
$requests = json_decode(file_get_contents("php://input"));
$gQ = getQuestions();
$output = array();
$i = 0;
foreach ($gQ as $q) {
$output[$i] = array("id" => $q['id'], "question" => $q['question'], "choices" => $q['choices']);
$i++;
}
echo '{"result":' . json_encode($output) . '}';
开发者ID:firdausibnu,项目名称:webdes,代码行数:12,代码来源:questions.php
示例6: mysql_query
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
while ($r = mysql_fetch_assoc($results)) {
$rows[] = array('text' => $r["text"], 'votes' => $r["numvotes"], 'answered' => $r["answered"], 'type' => 'Q');
}
} elseif ($type == 'F') {
// Query Feedback and fetch results
$query = sprintf("SELECT * FROM Feedback WHERE sid = %d", $sid);
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
while ($r = mysql_fetch_assoc($results)) {
$rows[] = array('text' => $r["text"], 'votes' => $r["numvotes"], 'isread' => $r["isread"], 'type' => 'F');
}
}
mysql_close($db_conn);
return $rows;
}
}
if (isset($_POST['sid']) && isset($_POST['type'])) {
$sid = $_POST['sid'];
$type = $_POST['type'];
$results = getQuestions($sid, $type);
// Return the questions and feedback back to the calling Javascript
// as a JSON object
header('Content-type: application/json');
echo json_encode($results);
}
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:31,代码来源:studenthome_lookup_questions.php
示例7: die
<?php
$apiKey = $_GET['apiKey'];
$formID = $_GET['formID'];
$format = $_GET['format'];
$columnHeaders = $_GET['columnHeaders'];
if ($formID < 1) {
die("Form ID Missing!");
}
include 'form_details.php';
$formTitle = getFormTitle($apiKey, $formID);
$questions = getQuestions($apiKey, $formID, $columnHeaders);
$submissions = getSubmissions($apiKey, $formID);
switch ($format) {
case 'PostgreSQL':
include 'jotform_postgresqldump.php';
$sql = jotform_postgresqldump($apiKey, $format, $formTitle, $questions, $submissions);
break;
case 'Oracle':
include 'jotform_oracledump.php';
$sql = jotform_oracledump($apiKey, $format, $formTitle, $questions, $submissions);
break;
case 'SQL Server':
include 'jotform_sqlserverdump.php';
$sql = jotform_sqlserverdump($apiKey, $format, $formTitle, $questions, $submissions);
break;
case 'DB2':
include 'jotform_db2dump.php';
$sql = jotform_db2dump($apiKey, $format, $formTitle, $questions, $submissions);
break;
case 'Sybase':
开发者ID:abmedia,项目名称:api-use-cases,代码行数:31,代码来源:get_mysqldump.php
示例8: postQuestion
require_once "./includes/mysql.php";
include "./includes/header.php";
?>
<?php
if (isset($_POST['type'])) {
if ($_POST['type'] == 'ask') {
postQuestion($_POST);
}
}
$q = '';
if (isset($_GET['q']) && !is_null($_GET['q'])) {
$q = $_GET['q'];
$questions = getQuestions($_GET['q']);
} else {
$questions = getQuestions();
}
?>
<div id="main-page" onload="function() {document.getElementById('autofocus').focus();}">
<div id="main-search" class="center">
<form action="index.php" method="GET">
<input autofocus="autofocus" type="text" name="q" id="search-bar" placeholder="Search question topic or content here..." value="<?php
echo $q;
?>
">
<input type="submit" value="Search">
</form>
<p>Cannot find what you are looking for? <a href="ask.php">Ask here</a></p>
</div>
开发者ID:natanelia,项目名称:IF3110-2015-T1,代码行数:30,代码来源:index.php
示例9: getQuestions
} else {
echo "<tr>";
}
if ($feed[$row]["voted"] == 1) {
echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " checked=true /></td>";
} else {
echo "<td class=checked><input class=check type=checkbox id=check_" . $feed[$row]["type"] . $feed[$row]["id"] . " /></td>";
}
echo "<td class=feed>" . $feed[$row]["text"] . "</td>";
if ($feed[$row]["type"] == 'Q' && $feed[$row]["answered"] == 1 || $feed[$row]["type"] == 'F' && $feed[$row]["isread"] == 1) {
echo "<td class=answered>Yes</td>";
} else {
echo "<td class=answered>No</td>";
}
//echo "<td class=answered>".$feed[$row]["answered"]."</td>";
echo "</tr>";
}
}
echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort']) && isset($_POST['uid'])) {
$sid = $_POST['sid'];
$filter = $_POST['filter'];
$sort = $_POST['sort'];
$uid = $_POST['uid'];
$feed = getQuestions($sid, $filter, $sort, $uid);
echoTable($feed);
}
?>
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:29,代码来源:studentfeed_lookup_questions.php
示例10: session_start
session_start();
$_SESSION['player_type'] = getGenderFromType(filter_var($_POST['player_type']));
$_SESSION['play'] = true;
$_SESSION['name'] = getWho($_POST['player_type']);
$_SESSION['result'] = 0;
echo json_encode(true);
} else {
session_start();
if (!isset($_SESSION['play'])) {
header("location: " . URL . HOME);
exit;
}
}
if (isset($_SESSION['play'])) {
$ques_type = $_SESSION['player_type'];
$questions = getQuestions($ques_type);
$options = getAnswerOpt($questions);
$name = $_SESSION['name'];
}
function getGenderFromType($type)
{
$female = "Female";
$male = "Male";
$self = "Self";
$me = "Me";
$mother = "Wife";
$sister = "Sister";
$father = "Husband";
$brother = "Brother";
$friendMale = "Friend-male";
$friendFemale = "Friend-female";
开发者ID:uchechukwudim,项目名称:testandtreatmalaria,代码行数:31,代码来源:process_questions.php
示例11: echoTable
}
function echoTable($rows)
{
// Prints out the feed data in a nice html format
echo "<table id=feedTable>";
for ($row = 0; $row < 200; $row++) {
if (!empty($rows[$row])) {
if ($rows[$row]["type"] == "Q") {
echo "<tr class=alt>";
} else {
echo "<tr>";
}
echo "<td class=votes>" . $rows[$row]["votes"] . "</td>";
echo "<td class=feed>" . $rows[$row]["text"] . "</td>";
if ($rows[$row]["answered"] == 1 || $rows[$row]["isread"] == 1) {
echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . " checked=true /></td>";
} else {
echo "<td class=checked><input class=check type=checkbox id=check_" . $rows[$row]["type"] . $rows[$row]["id"] . "/></td>";
}
echo "</tr>";
}
}
echo "</table>";
}
if (isset($_POST['sid']) && isset($_POST['filter']) && isset($_POST['sort'])) {
$sid = $_POST['sid'];
$filter = $_POST['filter'];
$sort = $_POST['sort'];
$rows = getQuestions($sid, $filter, $sort);
echoTable($rows);
}
开发者ID:kumarsivarajan,项目名称:classroom-presenter,代码行数:31,代码来源:lookup_questions.php
示例12: loadContestData
function loadContestData($db)
{
global $tinyOrm, $config;
$teamID = $_SESSION["teamID"];
$stmt = $db->prepare("UPDATE `team` SET `startTime` = NOW() WHERE `ID` = :teamID AND `startTime` IS NULL");
$stmt->execute(array("teamID" => $teamID));
if ($config->db->use == 'dynamoDB') {
$stmt = $db->prepare("SELECT `startTime` FROM `team` WHERE `ID` = :teamID");
$stmt->execute(array("teamID" => $teamID));
$row = $stmt->fetchObject();
try {
$tinyOrm->update('team', array('startTime' => $row->startTime), array('ID' => $teamID, 'startTime' => null));
} catch (\Aws\DynamoDb\Exception $e) {
error_log($e->getMessage . " - " . $e->getCode());
error_log('DynamoDB error updating team for teamID: ' . $teamID);
}
}
$questionsData = getQuestions($db, $_SESSION["contestID"]);
//$stmt = $db->prepare("SELECT `questionID`, `answer` FROM `team_question` WHERE `teamID` = ?");
//$stmt->execute(array($teamID));
try {
$results = $tinyOrm->select('team_question', array('questionID', 'answer', 'ffScore'), array('teamID' => $teamID));
} catch (\Aws\DynamoDb\Exception $e) {
error_log($e->getMessage . " - " . $e->getCode());
error_log('DynamoDB error retrieving team_questions for teamID: ' . $teamID);
}
$answers = array();
$scores = array();
//while ($row = $stmt->fetchObject()) {
foreach ($results as $row) {
if (isset($row['answer'])) {
$answers[$row['questionID']] = $row['answer'];
}
if (isset($row['ffScore'])) {
$scores[$row['questionID']] = $row['ffScore'];
}
}
$stmt = $db->prepare("SELECT TIME_TO_SEC(TIMEDIFF(NOW(), `team`.`startTime`)) as `timeUsed`, `endTime` FROM `team` WHERE `ID` = ?");
$stmt->execute(array($teamID));
$row = $stmt->fetchObject();
$_SESSION["startTime"] = time() - intval($row->timeUsed);
if ($row->endTime != null) {
$_SESSION["closed"] = true;
}
echo json_encode((object) array("success" => true, "questionsData" => $questionsData, 'scores' => $scores, "answers" => $answers, "timeUsed" => $row->timeUsed, "endTime" => $row->endTime, "teamPassword" => $_SESSION["teamPassword"]));
}
开发者ID:BebrasTeam,项目名称:BebrasContestServer,代码行数:46,代码来源:data.php
示例13: testGetReadFeedback
public function testGetReadFeedback()
{
$db_conn = $this->initAndClearTables();
$this->insertSubmission($db_conn, 'F', 'test1', 2, 1, 12345);
sleep(1);
$this->insertSubmission($db_conn, 'Q', 'test2', 1, 1, 12345);
sleep(1);
$this->insertSubmission($db_conn, 'F', 'test3', 0, 1, 12345);
sleep(1);
$this->insertSubmission($db_conn, 'Q', 'test4', 3, 1, 23456);
sleep(1);
$this->insertSubmission($db_conn, 'F', 'test5', 1, 1, 12345);
sleep(1);
$this->insertSubmission($db_conn, 'F', 'test6', 4, 0, 23456);
include_once '../../Incognito/instr/scripts/lookup_questions.php';
$feed = getQuestions(12345, "Read", "None");
$this->assertEquals(3, count($feed));
$this->assertEquals('test1', $feed[0]['text']);
$this->assertEquals('test3', $feed[1]['text']);
$this->assertEquals('test5', $feed[2]['text']);
$feed = getQuestions(12345, "Read", "Newest");
$this->assertEquals(3, count($feed));
$this->assertEquals('test5', $feed[0]['text']);
$this->assertEquals('test3', $feed[1]['text']);
$this->assertEquals('test1', $feed[2]['text']);
$feed = getQuestions(12345, "Read", "Priority");
$this->assertEquals(3, count($feed));
$this->assertEquals('test1', $feed[0]['text']);
$this->assertEquals('test5', $feed[1]['text']);
$this->assertEquals('test3', $feed[2]['text']);
}
开发者ID:sivarajankumar,项目名称:classroom-presenter,代码行数:31,代码来源:test-instructorfeed.php
示例14: getMyAnswers
} else {
$notify->add($lang->get('detailedpoll'), $lang->get('notify_send_unsuccessfull'));
}
} else {
$notify->add($lang->get('detailedpoll'), $lang->get('notify_send_unsuccessfull_fields_missing'));
$smarty->assign('values', $_POST['values']);
}
}
if (hasVoted($pollid, $login->currentUserId())) {
$smarty->assign('values', getMyAnswers($pollid, $login->currentUserId()));
}
$smarty->assign('sendAvailable', $poll['state'] == 1);
$smarty->assign('resultAvailable', $poll['state'] >= 2);
$smarty->assign('poll', $poll);
if ($poll['state'] >= 2) {
$questions = calculatePoll($pollid);
$smarty->assign('result', getCalculatedPoll($questions));
} else {
$questions = getQuestions($pollid);
}
$smarty->assign('questions', $questions);
$colors = array(0 => '#aaa', 1 => '#bbb', 2 => '#ccc', 3 => '#ddd');
$smarty->assign('color', $colors);
$smarty->assign('path', $template_dir . '/poll.tpl');
} else {
$allpolls = getPolls();
$smarty->assign('polls', $allpolls);
$smarty->assign('path', $template_dir . '/polls.tpl');
}
break;
}
开发者ID:tech-nik89,项目名称:lpm4,代码行数:31,代码来源:detailedpoll.mod.php
示例15: getQuestions
$questions = 0;
$questions = getQuestions($t_id);
if (count($questions) == 0) {
echo '<div class="h8 centered">' . Global_07 . "</div>";
} else {
$topics->setTopicID($t_id);
$topics->setTopic($t_id);
$Topic = $topics->getTopicName();
echo "<br /><h2> " . Statistic_01 . " " . stripslashes($Topic) . "<br /></h2>";
getTopTenCorrect($questions);
}
break;
case 'flopTen':
// die 10 schlechtest beantworteten Fragen
$questions = 0;
$questions = getQuestions($t_id);
if (count($questions) == 0) {
echo '<div class="h8 centered">' . Global_07 . "</div>";
} else {
$topics->setTopicID($t_id);
$topics->setTopic($t_id);
$Topic = $topics->getTopicName();
echo "<br /><h2> " . Statistic_02 . " " . stripslashes($Topic) . "<br /></h2>";
getFlopTenCorrects($questions);
}
break;
case 'sortByTopic':
// Fragen nach Thema sortieren
$topics->getTopic();
$topicarray = $topics->getTopicArray();
$number = $qu->getNumberOfQuestions($topicarray);
开发者ID:eruedin,项目名称:cats,代码行数:31,代码来源:statistic.php
示例16: getQuestionData
function getQuestionData($statusId)
{
return getQuestions(getQuestionStatusById($statusId));
}
开发者ID:CSchool,项目名称:AIBattle,代码行数:4,代码来源:procedures.php
示例17: getQuestions
// EXPORT QUESTION GROUP BUTTON
if (bHasSurveyPermission($surveyid, 'surveycontent', 'export')) {
$groupsummary .= "<a href='{$scriptname}?action=exportstructureGroup&sid={$surveyid}&gid={$gid}' title=\"" . $clang->gTview("Export this question group") . "\" >" . "<img src='{$imageurl}/dumpgroup.png' title='' alt='" . $clang->gT("Export this question group") . "' name='ExportGroup' /></a>\n";
}
// CHANGE QUESTION ORDER BUTTON
if (bHasSurveyPermission($surveyid, 'surveycontent', 'update')) {
$groupsummary .= "<img src='{$imageurl}/seperator.gif' alt='' />\n";
if ($activated != "Y" && getQuestionSum($surveyid, $gid) > 1) {
// $groupsummary .= "<img src='$imageurl/blank.gif' alt='' width='40' />\n";
// $groupsummary .= "<img src='$imageurl/seperator.gif' alt='' />\n";
$groupsummary .= "<a href='{$scriptname}?action=orderquestions&sid={$surveyid}&gid={$gid}' title=\"" . $clang->gTview("Change Question Order") . "\" >" . "<img src='{$imageurl}/reorder.png' alt='" . $clang->gT("Change Question Order") . "' name='updatequestionorder' /></a>\n";
} else {
$groupsummary .= "<img src='{$imageurl}/blank.gif' alt='' width='40' />\n";
}
}
$groupsummary .= "</div>\n" . "<div class='menubar-right'>\n" . "<span class=\"boxcaption\">" . $clang->gT("Questions") . ":</span><select class=\"listboxquestions\" name='qid' " . "onchange=\"window.open(this.options[this.selectedIndex].value, '_top')\">" . getQuestions($surveyid, $gid, $qid) . "</select>\n";
// QUICK NAVIGATION TO PREVIOUS AND NEXT QUESTION
// TODO: Fix functionality to previos and next question buttons (Andrie)
$QidPrev = getQidPrevious($surveyid, $gid, $qid);
$groupsummary .= "<span class='arrow-wrapper'>";
if ($QidPrev != "") {
$groupsummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&gid={$gid}&qid={$QidPrev}'>" . "<img src='{$imageurl}/previous_20.png' title='' alt='" . $clang->gT("Previous question") . "' " . "name='questiongroupprevious'/></a>";
} else {
$groupsummary .= "" . "<img src='{$imageurl}/previous_disabled_20.png' title='' alt='" . $clang->gT("No previous question") . "' " . "name='noquestionprevious' />";
}
$QidNext = getQidNext($surveyid, $gid, $qid);
if ($QidNext != "") {
$groupsummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&gid={$gid}&qid={$QidNext}'>" . "<img src='{$imageurl}/next_20.png' title='' alt='" . $clang->gT("Next question") . "' " . "name='questionnext' /> </a>";
} else {
$groupsummary .= "" . "<img src='{$imageurl}/next_disabled_20.png' title='' alt='" . $clang->gT("No next question") . "' " . "name='noquestionnext' />";
}
开发者ID:himanshu12k,项目名称:ce-www,代码行数:31,代码来源:html.php
示例18: deleteRecurse
} else {
if ($mode == "aws+local") {
deleteRecurse($contestLocalDir . $contestFolder);
mkdir($contestLocalDir . $contestFolder, 0777, true);
$publicClient->deleteMatchingObjects($publicBucket, 'contests/' . $contestFolder);
} else {
deleteRecurse($contestLocalDir . $contestFolder);
if (!mkdir($contestLocalDir . $contestFolder, 0777, true)) {
exit;
}
}
}
}
if (!isset($_REQUEST['tasks'])) {
// Retrieve the question's list
$questions = getQuestions($db, $contestID);
$questionsUrl = array();
foreach ($questions as $curQuestion) {
$questionsUrl[] = $curQuestion->folder . '/' . $curQuestion->key . '/';
}
emptyContestDir($contestFolder);
echo json_encode(array('questionsUrl' => $questionsUrl));
exit;
}
if (isset($_REQUEST['tasks']) && $_REQUEST['tasks']) {
$tasks = json_decode($_REQUEST['tasks'], true);
emptyContestDir($contestFolder);
generateContest($tasks, $contestID, $contestFolder, isset($_REQUEST['fullFeedback']) ? $_REQUEST['fullFeedback'] : false, isset($_REQUEST['status']) ? $_REQUEST['status'] : 'RunningContest');
}
function contestAddContent($contestFolder, $content, &$listParts, &$buffer, &$numPart, $isLast)
{
开发者ID:BebrasTeam,项目名称:BebrasContestServer,代码行数:31,代码来源:generateContest.php
示例19: getQuestions
echo $iIconSize;
?>
"/></a>
<?php
}
?>
</div>
<div class='menubar-right'>
<label for="questionid"><?php
$clang->eT("Questions:");
?>
</label> <select class="listboxquestions" name='questionid' id='questionid'
onchange="window.open(this.options[this.selectedIndex].value, '_top')">
<?php
echo getQuestions($surveyid, $gid, $qid);
?>
</select>
<span class='arrow-wrapper'>
<?php
if ($QidPrev != "") {
?>
<a href='<?php
echo $this->createUrl("admin/survey/sa/view/surveyid/" . $surveyid . "/gid/" . $gid . "/qid/" . $QidPrev);
?>
'>
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:31,代码来源:questiongroupbar_view.php
示例20: testAutoComplete
public function testAutoComplete()
{
include '../../db_credentials.php';
$db_conn = mysql_connect("cubist.cs.washington.edu", $username, $password);
if (!$db_conn) {
die("Could not connect");
}
mysql_select_db($db_name, $db_conn);
// Wipe the tables
$query = "DELETE FROM Question";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "DELETE FROM Feedback";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
// Insert some test values
$query = "INSERT INTO Question (text, numvotes, answered, sid) VALUES ('test1', 0, 0, 23456)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "INSERT INTO Question (text, numvotes, answered, sid) VALUES ('test2', 1, 0, 23456)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "INSERT INTO Question (text, numvotes, answered, sid) VALUES ('test3', 1, 0, 12345)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "INSERT INTO Feedback (text, numvotes, isread, sid) VALUES ('test4', 0, 0, 23456)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "INSERT INTO Feedback (text, numvotes, isread, sid) VALUES ('test5', 0, 0, 12345)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
$query = "INSERT INTO Feedback (text, numvotes, isread, sid) VALUES ('test6', 0, 0, 23456)";
$results = mysql_query($query, $db_conn);
if (!$results) {
die("Error: " . mysql_error($db_conn));
}
include '../../Incognito/students/scripts/studenthome_lookup_questions.php';
$array = getQuestions(23456, 'Q');
$this->assertEquals('test1', $array[0]['text']);
$this->assertEquals('test2', $array[1]['text']);
$this->assertEquals(2, count($array));
$array = getQuestions(12345, 'Q');
$this->assertEquals('test3', $array[0]['text']);
$this->assertEquals(1, count($array));
$array = getQuestions(23456, 'F');
$this->assertEquals('test4', $array[0]['text']);
$this->assertEquals('test6', $array[1]['text']);
$this->assertEquals(2, count($array));
$array = getQuestions(12345, 'F');
$this->assertEquals('test5', $array[0]['text']);
$this->assertEquals(1, count($array));
}
开发者ID:sivarajankumar,项目名称:classroom-presenter,代码行数:66,代码来源:test-autocomplete.php
注:本文中的getQuestions函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论