本文整理匯總了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();
}
}