1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- include "auth.php";
- if (isset($_POST['machine'])) {
- $machineid = htmlentities(mysqli_real_escape_string($link, $_POST['machine']));
- $query = "SELECT * FROM object_detals WHERE id_name=$machineid";
- $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));
- while ($res1 = mysqli_fetch_array($result)) {
- $query2 = "SELECT * FROM type_detals WHERE id=" . $res1['id_type'] . "";
- $result2 = mysqli_query($link, $query2) or die("Ошибка " . mysqli_error($link));
- while ($res2 = mysqli_fetch_array($result2)) {
- $query3 = "SELECT name FROM type_object WHERE id=" . $res2['id_type'] . "";
- $result3 = mysqli_query($link, $query3) or die("Ошибка " . mysqli_error($link));
- $res3 = mysqli_fetch_array($result3);
- $typeobject=$res3['name'];
- }
- }
- echo "<b> Тип: " .$typeobject."</b>";
- echo "<br>";
- echo "<br>";
- echo "
- <form action='?act=object' id='my_form2' method='POST'>
- <input type='hidden' name='id_name' value='$machineid'> ";
- $query = "SELECT * FROM object_detals WHERE id_name=$machineid";
- $result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link));
- while ($res1 = mysqli_fetch_array($result))
- {
- $id_type=$res1['id_type'];
- $query2 = "SELECT * FROM object_detals WHERE id_type=$id_type";
- $result2 = mysqli_query($link, $query2) or die("Ошибка " . mysqli_error($link));
- while ($res2 = mysqli_fetch_array($result2)) {
- $type=$res2['type'];
- switch($type) {
- case 'typetext' :
- echo "[text] ";
- break;
- case 'typeint' :
- echo "[int] ";
- break;
- case 'typefloat' :
- echo "[float] ";
- break;
- case 'typebinary' :
- echo "[binary] ";
- break;
- }
- echo $res2['name_detals'] . " ";
- if($res1['link']!=null) {
- echo "<a href=" . $res1['link'] . ">" . $res2[$type] . "</a>";
- }
- else {
- echo "
- <input type='hidden' name='type".$id_type."' value='$type'>
- <input type='text' name='count".$id_type."' value ='".$res2[$type]."' > ";
- }
- }
- echo "<br>";
- }
- echo " <input id='save' type='submit' name='save' value='Сохранить'>
- </form>";
- }
- else
- echo "invalidate";
|