Guest User

Untitled

a guest
May 25th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.04 KB | None | 0 0
  1. <?php
  2. require_once("design/top.php");
  3. ?>         
  4.         <section id="content">
  5.             <div class="g12">
  6.                 <?php notification($error, $message);?>
  7.                 <form id="" action="" method="post" data-ajax="false">
  8.                     <fieldset>
  9.                         <label>Robothistorikk</label>
  10.                         <section>
  11.                             <table>
  12.                                 <tbody>
  13.                                     <tr>
  14.                                         <td><span><strong>Robot:    </strong>&nbsp;&nbsp;</span><input id="integer" name="searchRobot" type="number" class="integer" maxlength="2"></td>
  15.                                         <td><span><strong>Dato:     </strong>&nbsp;&nbsp;</span><input id="date" name="searchDate" type="text" class="date"></td>
  16.                                         <td><span><strong>Feilkode: </strong>&nbsp;&nbsp;</span><input id="integer" name="searchErrorcode" type="number" class="errorcode" maxlength="3"></td>
  17.                                         <td><span><strong>Koordinat:</strong>&nbsp;&nbsp;</span><input type="text" class="xy" id="" name="searchCoordinate"></td>
  18.                                         <td><span><strong>Logget av:</strong>&nbsp;&nbsp;</span></span><input id="nick" name="searchLoggedBy" type="number" class="nick"></td>
  19.                                         <td><button class="submit" name="search">Søk</button></td>
  20.                                     </tr>
  21.                                 <tbody>
  22.                             </table>
  23.                         </section>
  24.                     </fieldset>
  25.                 </form>
  26.                 <table>
  27.                     <thead>
  28.                         <tr>
  29.                             <th>Status&nbsp;&nbsp;&nbsp;&nbsp;</th>
  30.                             <th>Dato</th>
  31.                             <th>Robot&nbsp;&nbsp;&nbsp;&nbsp;</th>
  32.                             <th>X/Y&nbsp;&nbsp;&nbsp;&nbsp;</th>
  33.                             <th>Port&nbsp;&nbsp;&nbsp;&nbsp;</th>
  34.                             <th>Feilkode&nbsp;&nbsp;</th>
  35.                             <th>Feilmedling</th>
  36.                             <th>Observasjon</th>
  37.                             <th>Løsning</th>
  38.                             <th>Nedetid&nbsp;&nbsp;&nbsp;&nbsp;</th>
  39.                         </tr>
  40.                     </thead>
  41.                     <tbody>
  42.                         <?php
  43.                         if(isset($_POST['search'])) {
  44.                             $s_robot    = $_POST['searchRobot'];
  45.                             $s_date     = $_POST['searchDate'];
  46.                             $s_code     = $_POST['searchErrorcode'];
  47.                             $s_position = $_POST['searchCoordinate'];
  48.                             $s_nick     = $_POST['searchLoggedBy'];
  49.                            
  50.                             //Check witch query to select. Can be made simplier, not priority
  51.                             if(!empty($s_robot)) {
  52.                                 $searchQuery = mysql_query("SELECT * FROM robot_error WHERE robot = '$s_robot' ORDER BY id DESC");
  53.                             }
  54.                             elseif(!empty($s_date)) {
  55.                                 $searchQuery = mysql_query("SELECT * FROM robot_error WHERE date = '$s_date' ORDER BY id DESC");
  56.                             }
  57.                             elseif(!empty($s_code)) {
  58.                                 $searchQuery = mysql_query("SELECT * FROM robot_error WHERE error_code = '$s_code' ORDER BY id DESC");
  59.                             }
  60.                             elseif(!empty($s_position)) {
  61.                                 $searchQuery = mysql_query("SELECT * FROM robot_error WHERE position = '$s_position' ORDER BY id DESC");
  62.                             }
  63.                             elseif(!empty($s_nick)) {
  64.                                 $searchQuery = mysql_query("SELECT * FROM robot_error WHERE logged_by = '$s_nick' ORDER BY id DESC");
  65.                             }
  66.                            
  67.                             if($s_robot != "") {
  68.                                 $search_robot = $s_robot;
  69.                             }
  70.                             else {
  71.                                 $inf = mysql_fetch_array($searchSQL);
  72.                                 $search_robot = $inf['robot'];
  73.                             }
  74.                         }
  75.                         ?>
  76.                     </tbody>
  77.                 </table>
  78.             </div>
  79.         </section>
  80. <?php
  81. require_once("design/bottom.php");
  82. ?>
Add Comment
Please, Sign In to add comment