本文整理匯總了PHP中Ajax::setError方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ajax::setError方法的具體用法?PHP Ajax::setError怎麽用?PHP Ajax::setError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ajax
的用法示例。
在下文中一共展示了Ajax::setError方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: while
while ($question = $questions_result->fetch_object()) {
if (!isset($set[(int) $question->question_id])) {
$break = true;
break;
}
}
if (!$break) {
$i = 1;
foreach ($set as $k => $v) {
// echo 'UPDATE question SET question_num='.$i.' WHERE question_id='.$k.' AND question_questionnaire_id='.$questionnaire_id;
$_MYSQLI->query('UPDATE question SET question_num=' . $i . ' WHERE question_id=' . $k . ' AND question_questionnaire_id=' . $questionnaire_id);
$i++;
}
$ajax->data = $orders;
} else {
$ajax->setError("query_error: order argument fail, an id does not exist in database");
}
} else {
$ajax->setError("query_error: order argument fail, not the same entry number that in database");
}
} else {
$ajax->setError("query_error: questionnaire does not exist or you are not the owner");
}
} else {
$ajax->setError("query_error: bad arguments");
}
} else {
$ajax->setError("query_error: missing POST arguments");
}
} else {
$ajax->setError("not_logged");
示例2: while
FROM question q
JOIN choice c ON c.choice_question_id = q.question_id
INNER JOIN answer a ON a.answer_choice_id = c.choice_id
INNER JOIN user u ON u.user_id = a.answer_student_user_id
WHERE question_questionnaire_id = ' . $_MYSQLI->real_escape_string($_GET["questionnaire_id"]) . '
GROUP BY answer_student_user_id, choice_id';
$answer_result = $_MYSQLI->query($query);
while ($answer = $answer_result->fetch_object()) {
if (isset($ajax->data["questions"][$answer->question_id])) {
if (!isset($ajax->data["answers"][$answer->answer_student_user_id])) {
$ajax->data["answers"][$answer->answer_student_user_id] = array("identity" => $answer->user_identity, "score" => $question_keys);
}
if (isset($ajax->data["questions"][$answer->question_id]["choices"][$answer->choice_id])) {
if ($ajax->data["questions"][$answer->question_id]["choices"][$answer->choice_id]["correct"]) {
$ajax->data["answers"][$answer->answer_student_user_id]["score"][$answer->question_id]["correct"]++;
} else {
$ajax->data["answers"][$answer->answer_student_user_id]["score"][$answer->question_id]["uncorrect"]++;
}
}
}
}
} else {
$ajax->setError("questionnaire not exists");
}
} else {
$ajax->setError("query_error: questionnaire_id missing");
}
} else {
$ajax->setError("not_logged");
}
$ajax->out();