コード例 #1
0
<?php

include "utility_functions.php";
//Access level
$access = "a";
$sessionid = $_GET["sessionid"];
verify_session($sessionid, $access);
ini_set("display_errors", 0);
$id = $_POST["id"];
// Form the sql string and execute it.
$sql = array("delete from taken where id = '{$id}'", "delete from students where id = '{$id}'");
$result_array = execute_sqls_in_mysql($sql);
$result = $result_array["flag"];
$cursor = $result_array["cursor"];
if ($cursor == false) {
    // Error handling interface.
    echo "<B>Deletion Failed.</B> <BR />";
    die("<i> \n\n  <form method=\"post\" action=\"manage.php?sessionid={$sessionid}\">\n  Read the error message, and then try again:\n  <input type=\"submit\" value=\"Go Back\">\n  </form>\n\n  </i>\n  ");
}
// Record deleted.  Go back.
Header("Location:manage.php?sessionid={$sessionid}");
コード例 #2
0
 $sql = array("set transaction isolation level serializable");
 $sql[] = "create or replace view seat_count(seqid, seat_count) as select seqid, count(*) from taken t group by seqid order by seqid";
 $sql[] = "select c.seat_count, s.seats from sections s left join seat_count c on s.seqid = c.seqid where s.seqid = '{$seqids[$i]}'";
 //$sql[] = "drop view seat_count";
 //var_dump($sql);
 $result_array = execute_sqls_in_mysql_without_commit($sql);
 $result = $result_array["flag"];
 $cursor = $result_array["cursor"];
 if ($cursor == false) {
     //display_oracle_error_message($cursor);
     die("Client Query Failed.");
 }
 $values = mysqli_fetch_array($cursor);
 mysqli_free_result($cursor);
 $sql_clear = array("drop view seat_count", "commit");
 $result_array = execute_sqls_in_mysql($sql_clear);
 if ($values[0] == '') {
     $values[0] = 0;
 }
 if ($values[0] >= $values[1]) {
     $class_full = true;
 }
 if ($prereq_check_result == false and !$class_full and !$already_registered) {
     $sql = "insert into taken values ('{$user_info['1']}', '{$seqids[$i]}', null)";
     $result_array = execute_sql_in_mysql($sql);
     $result = $result_array["flag"];
     $cursor = $result_array["cursor"];
     if ($cursor == false) {
         //display_oracle_error_message($cursor);
         die("Client Query Failed.");
     }