<?php

include "config.php";
$FARS = new FARS();
$FARS->is_login();
include_once "header.php";
if (!$FARS->has_authority(1)) {
    echo "no authority";
    include_once "footer.php";
    exit;
}
if (isset($_REQUEST['delete'])) {
    $sql = "delete from `teacher` where `id` = '" . $_REQUEST['teacher_id'] . "' limit 1 ;";
    // echo ($sql);
    $query = mysql_query($sql);
    echo "affected row " . mysql_affected_rows();
    include_once "footer.php";
    exit;
}
$query = mysql_query('show full fields from `teacher` ;');
$field = array();
while ($res = mysql_fetch_array($query)) {
    $field[$res['Field']] = "";
}
$query = mysql_query('SHOW TABLES');
$table = array();
while ($res = mysql_fetch_array($query)) {
    array_push($table, $res['0']);
}
if (isset($_REQUEST['submit'])) {
    $submit = array();
<?php

include "config.php";
$FARS = new FARS();
$FARS->is_login();
include_once "header.php";
if (!$FARS->has_authority(1)) {
    echo "no authority";
    include_once "footer.php";
    exit;
}
$_table = @$_REQUEST['table'];
if ('teacher' !== $_table && 'project' !== $_table) {
    $_table = "teacher";
}
$query = mysql_query("show full fields from `{$_table}` ;");
$field = array();
while ($res = mysql_fetch_array($query)) {
    $field[$res['0']] = $res['Comment'];
}
$query = mysql_query('SHOW TABLES');
$table = array();
while ($res = mysql_fetch_array($query)) {
    array_push($table, $res['0']);
}
?>

<table class="ui celled padded table">
  <thead>
    <tr>
<?php