Greenscape Environmental Experience & Learning Survey Experiments

Manage Teachers

query("SELECT * FROM user_account WHERE user_id = ".$_SESSION['userID']); if($result) { while ( $row = $result->fetch_assoc() ){ $db_sid = $row['school_id']; } } // If 'School-Code' exist if ($db_sid != 0){ // Get 'Teacher-Code' $result = $conn->query("SELECT specific_teacherCode FROM school WHERE school_id = ".$db_sid); if($result) { while ( $row = $result->fetch_assoc() ){ $db_tCode = $row['specific_teacherCode']; } } ?>
Note: This is the current Access-Code for your school's teachers, in the text-field
Add Code
query // ("SELECT user_id AS 'ID', username AS 'Username', SUBSTRING(password, 1, 20) AS 'Password', IFNULL(school_name,'Not Applicable') AS 'School', IFNULL(specific_classCode,'Not Applicable') AS 'Class',active AS 'Active' // FROM user_account // inner join user_role on user_account.accountType = user_role.role_id // left join school on user_account.school_id = school.school_id // left join school_class on user_account.class_id = school_class.class_id // WHERE accountType = 2 // ORDER BY user_id ASC"); // } // else{ // $result = $conn->query // ("SELECT user_id AS 'ID', username AS 'Username', SUBSTRING(password, 1, 20) AS 'Password', IFNULL(school_name,'Not Applicable') AS 'School', IFNULL(specific_classCode,'Not Applicable') AS 'Class',active AS 'Active' // FROM user_account // inner join user_role on user_account.accountType = user_role.role_id // left join school on user_account.school_id = school.school_id // left join school_class on user_account.class_id = school_class.class_id // Where accountType = 2 // AND user_account.school_id = $schoolID // ORDER BY user_id ASC"); // } $userAccount = $conn->query("SELECT accountType, school_id FROM user_account WHERE username = '".$_SESSION['user']. "'"); $row = $userAccount->fetch_assoc(); $userAccountType = $row['accountType']; $schoolID = $row['school_id']; //echo $schoolID; $userRole = $conn->query("SELECT role FROM user_role WHERE role_id = ".$userAccountType); //echo $userAccountType; // while ($row = $userAccount->fetch_assoc()) { // echo $row['accountType']."
"; // } // echo $_SESSION['user']; if($userAccountType == 5){ $result = $conn->query ("SELECT user_id AS 'ID', username AS 'Username', email AS 'Email', password AS 'Password', IFNULL(school_name,'Not Applicable') AS 'School',active AS 'Active' FROM user_account inner join user_role on user_account.accountType = user_role.role_id left join school on user_account.school_id = school.school_id left join school_class on user_account.class_id = school_class.class_id WHERE accountType = 2 ORDER BY user_id ASC"); } else{ $result = $conn->query ("SELECT user_id AS 'ID', username AS 'Username', email AS 'Email', password AS 'Password', IFNULL(school_name,'Not Applicable') AS 'School',active AS 'Active' FROM user_account inner join user_role on user_account.accountType = user_role.role_id left join school on user_account.school_id = school.school_id left join school_class on user_account.class_id = school_class.class_id Where accountType = 2 AND user_account.school_id = $schoolID ORDER BY user_id ASC"); } $tablesAndTheirData = array(); array_push($tablesAndTheirData, array( 'fields' => $result->fetch_fields(), 'data' => $result )); foreach($tablesAndTheirData as $table){ if($table['data']->num_rows){ ?> fetch_assoc()){ $order_num++; ?> $value){ if ($key == 'ID'){ $index = $value; } ?>
ID Username Email Password School Active
Add Teacher

New Teacher

Note: The teacher must already has an (participant) account with GEESE, and to assign here by searching their username.
Find Teacher