本文整理汇总了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();