本文整理汇总了PHP中UserUtils::studentid_exists方法的典型用法代码示例。如果您正苦于以下问题:PHP UserUtils::studentid_exists方法的具体用法?PHP UserUtils::studentid_exists怎么用?PHP UserUtils::studentid_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserUtils
的用法示例。
在下文中一共展示了UserUtils::studentid_exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Build an array of unique student names.
$students = array();
foreach ($lines as $separate_line) {
if (trim($separate_line) != '') {
$fields = explode(',', $separate_line);
$sid = trim($fields[0]);
$session = trim($fields[2]);
// Modules will be added later.
$students[$sid]['sid'] = $sid;
$students[$sid]['session'] = $session;
$students[$sid]['modules'] = array();
}
}
// Query the modules for each student
foreach ($students as $student) {
$student_databaseID = UserUtils::studentid_exists($student['sid'], $mysqli);
if ($student_databaseID !== false) {
$students[$student['sid']]['dbID'] = $student_databaseID;
$result = $mysqli->prepare("SELECT moduleid, attempt FROM modules_student, modules WHERE modules_student.idMod = modules.id AND userID = ? AND calendar_year = ?");
$result->bind_param('is', $student_databaseID, $student['session']);
$result->execute();
$result->store_result();
$result->bind_result($moduleid, $attempt);
while ($result->fetch()) {
if (isset($module_list[$moduleid])) {
$students[$student['sid']]['modules'][$moduleid][] = $attempt;
}
}
$result->close();
}
}