mirror of
https://github.com/FlyInTheBox/31TSAI.git
synced 2024-12-22 14:26:59 +01:00
a
This commit is contained in:
parent
9bf38f2e42
commit
d7e069dce2
3 changed files with 45 additions and 21 deletions
|
@ -1,24 +1,24 @@
|
|||
<?php $sql_dept = "SELECT id FROM dept;";
|
||||
$wyn_dept = mysqli_query($id_conn, $sql_dept);
|
||||
if (mysqli_error($id_conn)) {
|
||||
echo "Błąd w zapytaniu o stanowiska: " . $baza . '(' . mysqli_error($id_conn) .')';
|
||||
mysqli_close($id_conn);
|
||||
exit;
|
||||
<?php
|
||||
$sql_mgr = "SELECT id, last_name FROM emp";
|
||||
$wyn_mgr = mysqli_query($id_conn, $sql_mgr);
|
||||
if (!$wyn_mgr || mysqli_error($id_conn)) {
|
||||
echo "Błąd w zapytaniu o departamenty: " . $baza . '(' . mysqli_error($id_conn) . ')';
|
||||
mysqli_close($id_conn);
|
||||
exit;
|
||||
}
|
||||
|
||||
$ok_dept = 0;
|
||||
$depts = '';
|
||||
$dept = '';
|
||||
while($w_dept=mysqli_fetch_array($wyn_dept)) {
|
||||
if ($w_dept['id'] == $dept) {
|
||||
$ok_dept = 1;
|
||||
}
|
||||
$depts = $depts . ', <br> -' . $w_dept['id'];
|
||||
$ok_mgr = 0;
|
||||
$mgrs = '';
|
||||
while ($w_mgr = mysqli_fetch_array($wyn_mgr)) {
|
||||
if ($w_mgr['id'] == $mid) {
|
||||
$ok_mgr = 1;
|
||||
}
|
||||
$mgrs .= ', <br> -' . $w_mgr['id'] . ", " . $w_mgr['last_name'];
|
||||
}
|
||||
|
||||
if($ok_dept == 0) {
|
||||
echo 'Nie ma departamentu "' .$dept . '", wybierz jedno z poniższych: ';
|
||||
echo '<br>' . substr($depts, 6);
|
||||
mysqli_close($id_conn);
|
||||
exit;
|
||||
if ($ok_mgr == 0) {
|
||||
echo 'Nie ma menadżera "' . $mid . '", wybierz jeden z poniższych: ';
|
||||
echo '<br>' . substr($mgrs, 6);
|
||||
}
|
||||
|
||||
?>
|
|
@ -87,7 +87,7 @@ if (!mysqli_query($id_conn, $sql_ins))
|
|||
$ok_dept = 0;
|
||||
$depts = '';
|
||||
while ($w_dept = mysqli_fetch_array($wyn_dept)) {
|
||||
if ($w_dept['id'] . $w_dept['deptName'] . $w_dept['regionName'] == $did) {
|
||||
if ($w_dept['id'] == $did) {
|
||||
$ok_dept = 1;
|
||||
}
|
||||
$depts .= ', <br> -' . $w_dept['id']. ' | ' . $w_dept['deptName']. ' | ' . $w_dept['regionName'];
|
||||
|
@ -98,6 +98,30 @@ if (!mysqli_query($id_conn, $sql_ins))
|
|||
echo '<br>' . substr($depts, 6);
|
||||
}
|
||||
|
||||
$sql_mgr = "SELECT id, last_name FROM emp";
|
||||
$wyn_mgr = mysqli_query($id_conn, $sql_mgr);
|
||||
if (!$wyn_mgr || mysqli_error($id_conn)) {
|
||||
echo "Błąd w zapytaniu o departamenty: " . $baza . '(' . mysqli_error($id_conn) . ')';
|
||||
mysqli_close($id_conn);
|
||||
exit;
|
||||
}
|
||||
|
||||
$ok_mgr = 0;
|
||||
$mgrs = '';
|
||||
while ($w_mgr = mysqli_fetch_array($wyn_mgr)) {
|
||||
if ($w_mgr['id'] == $mid) {
|
||||
$ok_mgr = 1;
|
||||
}
|
||||
$mgrs .= ', <br> -' . $w_mgr['id'] . ", " . $w_mgr['last_name'];
|
||||
}
|
||||
|
||||
if ($ok_mgr == 0) {
|
||||
echo 'Nie ma menadżera "' . $mid . '", wybierz jeden z poniższych: ';
|
||||
echo '<br>' . substr($mgrs, 6);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
mysqli_close($id_conn); # zamyka połączenie z bazą
|
||||
exit;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<table cellspacing="0" cellpadding="0" border="0" style="width: 26%;" align="Left">
|
||||
<tbody align="Left">
|
||||
<form action='_MN_ins_prac.php' method='post'>
|
||||
<form action='ins_prac.php' method='post'>
|
||||
<tr><td width="160">Nazwisko:</td><td><input type='text' name='nazwisko' ></td></tr>
|
||||
<tr><td>Imię: </td><td><input type='text' name='imie' ></td></tr>
|
||||
<tr><td>Użytkownik: </td><td><input type='text' name='userid' ></td></tr>
|
||||
|
|
Loading…
Reference in a new issue