0 && $_SESSION['accountType'] < 4){ // Student, Teacher, School-Admin
$result_role = $conn->query("SELECT * FROM user_account WHERE user_id = '".$_SESSION['userID']."' ORDER BY class_id ASC");
if ($result_role){
while ( $row = $result_role->fetch_assoc() ){
echo "";
if ($_SESSION['accountType'] == 2){ // Teacher
$sql_where = "WHERE school_class.school_id = '".$row['school_id']."' AND school_class.teacher_id = '".$_SESSION['userID']."'";
}
else if ($_SESSION['accountType'] == 3){ // School-Admin
$sql_where = "WHERE school_class.school_id = '".$row['school_id']."'";
}
}
}
}
// $result = $conn->query("SELECT school_id AS 'sID', class_id AS 'ID', class_name AS 'Class Name', specific_classCode AS 'Access Code', teacher_id AS 'Teacher (username)' FROM school_class ".$sql_where." ORDER BY class_id ASC");
$result = $conn->query("SELECT school_class.school_id AS 'sID', school_class.class_id AS 'ID', IFNULL(school_name,'Not Assigned') AS 'School', school_class.teacher_id AS 'Teacher (username)', school_class.class_name AS 'Class Name', school_class.specific_classCode AS 'Access Code'
FROM school_class
INNER JOIN school on school_class.school_id = school.school_id
".$sql_where."
ORDER BY class_id ASC");
$tablesAndTheirData = array();
array_push($tablesAndTheirData, array(
'fields' => $result->fetch_fields(),
'data' => $result
));
$result = $conn->query("SELECT * FROM user_account WHERE user_id = ".$_SESSION['userID']);
if($result) {
while ( $row = $result->fetch_assoc() ){
$index_school = $row['school_id'];
}
}
foreach($tablesAndTheirData as $table){
if($table['data']->num_rows){
?>
name;?> | |
---|---|
query("SELECT * FROM user_account WHERE user_id = ".$value);
$row = $result->fetch_assoc();
$db_tid = $row['user_id'];
$db_tUsername = $row['username'];
// check if account is 'researcher' or 'super-admin' | id yes, show
if ( $_SESSION['accountType'] > 2 ){
$section_display = '';
}
else{
$section_display = 'display: none;';
}
?>
|