mirror of
https://github.com/FlyInTheBox/31TSAI.git
synced 2024-12-22 22:37:00 +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;";
|
<?php
|
||||||
$wyn_dept = mysqli_query($id_conn, $sql_dept);
|
$sql_mgr = "SELECT id, last_name FROM emp";
|
||||||
if (mysqli_error($id_conn)) {
|
$wyn_mgr = mysqli_query($id_conn, $sql_mgr);
|
||||||
echo "Błąd w zapytaniu o stanowiska: " . $baza . '(' . mysqli_error($id_conn) .')';
|
if (!$wyn_mgr || mysqli_error($id_conn)) {
|
||||||
|
echo "Błąd w zapytaniu o departamenty: " . $baza . '(' . mysqli_error($id_conn) . ')';
|
||||||
mysqli_close($id_conn);
|
mysqli_close($id_conn);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ok_dept = 0;
|
$ok_mgr = 0;
|
||||||
$depts = '';
|
$mgrs = '';
|
||||||
$dept = '';
|
while ($w_mgr = mysqli_fetch_array($wyn_mgr)) {
|
||||||
while($w_dept=mysqli_fetch_array($wyn_dept)) {
|
if ($w_mgr['id'] == $mid) {
|
||||||
if ($w_dept['id'] == $dept) {
|
$ok_mgr = 1;
|
||||||
$ok_dept = 1;
|
|
||||||
}
|
}
|
||||||
$depts = $depts . ', <br> -' . $w_dept['id'];
|
$mgrs .= ', <br> -' . $w_mgr['id'] . ", " . $w_mgr['last_name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ok_dept == 0) {
|
if ($ok_mgr == 0) {
|
||||||
echo 'Nie ma departamentu "' .$dept . '", wybierz jedno z poniższych: ';
|
echo 'Nie ma menadżera "' . $mid . '", wybierz jeden z poniższych: ';
|
||||||
echo '<br>' . substr($depts, 6);
|
echo '<br>' . substr($mgrs, 6);
|
||||||
mysqli_close($id_conn);
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
?>
|
|
@ -87,7 +87,7 @@ if (!mysqli_query($id_conn, $sql_ins))
|
||||||
$ok_dept = 0;
|
$ok_dept = 0;
|
||||||
$depts = '';
|
$depts = '';
|
||||||
while ($w_dept = mysqli_fetch_array($wyn_dept)) {
|
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;
|
$ok_dept = 1;
|
||||||
}
|
}
|
||||||
$depts .= ', <br> -' . $w_dept['id']. ' | ' . $w_dept['deptName']. ' | ' . $w_dept['regionName'];
|
$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);
|
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ą
|
mysqli_close($id_conn); # zamyka połączenie z bazą
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
<table cellspacing="0" cellpadding="0" border="0" style="width: 26%;" align="Left">
|
<table cellspacing="0" cellpadding="0" border="0" style="width: 26%;" align="Left">
|
||||||
<tbody 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 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>Imię: </td><td><input type='text' name='imie' ></td></tr>
|
||||||
<tr><td>Użytkownik: </td><td><input type='text' name='userid' ></td></tr>
|
<tr><td>Użytkownik: </td><td><input type='text' name='userid' ></td></tr>
|
||||||
|
|
Loading…
Reference in a new issue