Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(isset($_POST['search'])) {
- $s_robot = $_POST['searchRobot'];
- $s_date = $_POST['searchDate'];
- $s_code = $_POST['searchErrorcode'];
- $s_position = $_POST['searchCoordinate'];
- $s_nick = $_POST['searchLoggedBy'];
- //Check witch query to select (make it simplier in futher releases)
- if(!empty($s_robot)) {
- $searchQuery = "SELECT * FROM robot_error WHERE robot = '$s_robot' ORDER BY id DESC";
- }
- elseif(!empty($s_date)) {
- $searchQuery = "SELECT * FROM robot_error WHERE date = '$s_date' ORDER BY id DESC";
- }
- elseif(!empty($s_code)) {
- $searchQuery = "SELECT * FROM robot_error WHERE error_code = '$s_code' ORDER BY id DESC";
- }
- elseif(!empty($s_position)) {
- $searchQuery = "SELECT * FROM robot_error WHERE position = '$s_position' ORDER BY id DESC";
- }
- elseif(!empty($s_nick)) {
- $searchQuery = "SELECT * FROM robot_error WHERE logged_by = '$s_nick' ORDER BY id DESC";
- }
- $query = mysql_query($searchQuery);
- while($s_info = mysql_fetch_object($query)) {
- //First get information from new_robot_error table
- $e_robot = $s_info->robot;
- $e_date = $s_info->date;
- $e_position = $s_info->position;
- $e_error = $s_info->error_code;
- $e_observation = $s_info->observation;
- $e_solution = $s_info->solution;
- $e_downtime = convert_sec_2_hours($s_info->downtime);
- //Get information from other tables
- //Get robot status
- $e_status = get_robot_status($e_robot);
- //Check if error is at port
- $getPort = mysql_query("SELECT port_number FROM ports WHERE port_coordinate = '$e_position'");
- $portInfo = mysql_fetch_array($getPort);
- $e_port = $portInfo['port_number'];
- //Get errorsource
- $getErrorsource = mysql_query("SELECT error_message, error_source FROM errorcodes WHERE error_code = '$e_error'");
- $errorInfo = mysql_fetch_array($getErrorsource);
- $e_message = $errorInfo['error_message'];
- //Custom icons depending on robot status
- if($e_status == 0) {
- $class = "<tr class='gradeX'>";
- $field = "<td><img src='css/images/icons/light/cross.png'></td>";
- }
- else {
- $class = "<tr class='gradeA'>";
- $field = "<td><img src='css/images/icons/light/tick.png'></td>";
- }
- //Print result
- echo $class."\n";
- echo $field."\n";
- echo "<td>".$e_date."</td>\n";
- echo "<td>".$e_robot."</td>\n";
- echo "<td>".$e_position."</td>\n";
- echo "<td>".$e_port."</td>\n";
- echo "<td>".$e_error."</td>\n";
- echo "<td>".$e_message."</td>\n";
- echo "<td><textarea class='roboterror' data-autogrow='true'>".$e_observation."</textarea></td>\n";
- echo "<td><textarea class='roboterror' data-autogrow='true'>".$e_solution."</textarea></td>\n";
- echo "<td>".$e_downtime."</td>\n";
- echo "</tr>\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment