- <?php
- /** Épületek listája
- * @package koliportal
- */
-
- if (isset($_GET["bid"]) && is_numeric($_GET["bid"]))
- {
- $bid = $_GET["bid"];
-
- if ('delete-building' == $action)
- {
- t_start();
- $sql_d = "DELETE FROM buildings WHERE bid = '$bid'";
- debug_echo($sql_d, DEBUG_SQL);
- $del_res = mysql_query($sql_d, $database);
- if ($del_res === false)
- {
- $errs[] = "A törlés nem sikerült.";
- $errc++;
- }
-
- if (0 == $errc) {
- /* elég itt törölni, a room_conn_student-et majd a REFERENCES törli */
- $sql_d = "DELETE FROM rooms WHERE bid = '$bid'";
- debug_echo($sql_d, DEBUG_SQL);
- $del_res = mysql_query($sql_d, $database);
- if ($del_res === false)
- {
- $errs[] = "A törlés nem sikerült.";
- $errc++;
- }
- }
-
- if (0 === $errc)
- {
- t_commit();
- } else {
- t_rollback();
- }
-
- }
-
- }
-
- $action = 'buildinglist';
-
-
-
-
- $sql_q = "SELECT * FROM buildings AS b ORDER BY b.bsname";
-
- debug_echo($sql_q, DEBUG_SQL);
-
- $sql_res = mysql_query($sql_q, $database);
- if ($sql_res === false)
- {
- myerr(ERROR_DB, $sql_q);
- }
-
- show_errors($errs);
- ?>
- <table border="1" alt="Szobalista">
- <tr>
- <th>ID</th>
- <th>épület</th>
- <th>épület teljes neve</th>
- <th>Módosít</th>
- <tr>
-
-
- <?php
- while ($arr = mysql_fetch_assoc ($sql_res))
- {
- ?>
- <tr>
- <td><?= $arr["bid"] ?></td>
- <td><?= $arr["bsname"] ?></td>
- <td><?= $arr["bname"] ?></td>
- <td><a href="<?= $_SERVER["PHP_SELF"] ?>?bid=<?= $arr["bid"] ?>&action=delete-building">töröl</a></td>
- </tr>
- <?php
- }
- ?>
-
- </table>