简体   繁体   中英

Why is there Failed to load resource?

Why after typing is my PHP code, my webpage is not able to load? Is there anything wrong with my code? When I go to the development tool then console, it shows me this message:

Failed to load resource: the server responded with a status of 500 (Internal Server Error).

I'm new to webpage and PHP.

Below is the code:

<?php
# here database details
 $page_title = 'TP-HRG Centre';
 include ('includes/header.html');
 require ('mysqli_connect.php');

 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <!-- <meta http-equiv="refresh" content="30"> -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
      body {
        height: 100%;
        width: 100%;
        background-image: url("TPHRG floorplan1.png");
        background-repeat: no-repeat;
        background-attachment: fixed;
        /* background-position: center; */
        background-size: 980px 400px, cover;
      }

      .robot_start_top {
        top: 280px;
        transition: top 2s;
      }

      .robot_start_left {
        position: fixed;
        left: 600px;
        transition: all 2s;
      }

      .robot_end_left {
        left: 570px;
      }

      .robot_end_top {
        top: 180px;
      }

      .robot1_start_left {
        position: fixed;
        left: 570px;
        transition: left 4s;
      }

      .robot1_end_left {
        left: 520px;
      }

      .robot2_start_left {
        position: fixed;
        left: 520px;
        transition: left 4s;
      }

      .robot2_end_left {
        left: 470px;
      }
      .robot3_start_left {
        position: fixed;
        left: 470px;
        transition: left 4s;
      }

      .robot3_end_left {
        left: 420px;
      }

      .robot3_end_down {
        top: 280px;
      }

      .robot3_end_right {
        left: 600px;
      }
    </style>
  </head>
  <body onkeydown="move(event)">
    <div class="robot_start_left robot_start_top" id="app">
      <img id="robot" style= width:30px; height:40px" src="pic_8.PNG">
    </div>

    <script>
      $(document).ready(function(){
      document.getElementById("Tables").innerHTML = <?php echo $_REQUEST['id'];
      var move = function(event) {
        if (Tables === 1) {
          const appDiv = document.getElementById("app");
          setTimeout(function() {
            appDiv.classList.add("robot_end_top");
          }, 0);
          setTimeout(function() {
            appDiv.classList.add("robot_end_left");
          }, 2000);

        }

        if (Tables === 2) {
          const appDiv = document.getElementById("app");
          setTimeout(function() {
            appDiv.classList.add("robot_end_top");
          }, 0);
          setTimeout(function() {
            appDiv.classList.add("robot1_end_left");
          }, 2000);
        }

        if (Tables === 3) {
          const appDiv = document.getElementById("app");
          appDiv.classList.add("robot2_end_left");
        }

        if (Tables === 4) {
          const appDiv = document.getElementById("app");
          appDiv.classList.add("robot3_end_left");
        }

          if (Tables === 0) {
            const appDiv = document.getElementById("app");
            setTimeout(function() {
              appDiv.classList.add("robot3_end_down");
            }, 2000);
            setTimeout(function() {
              appDiv.classList.add("robot3_end_right");
            }, 0)
            setTimeout(function() { window.location.reload(true); }, 4000);
          }

      }
      ?>
    }
    </script>
  </body>
</html>

You have a syntax error in your code. Because you have display_errors turned off, and PHP exits with a non-zero exit code, the web server knows something went wrong and returns a generic HTTP 500 error response status code. See WSOD for more details on how to address this.

PHP Parse error:  syntax error, unexpected 'var' (T_VAR), expecting end of file in file on line 92

This is the offending line in your code:

                <script>
                  $(document).ready(function(){
                  document.getElementById("Tables").innerHTML = <?php echo $_REQUEST['id'];
                  var move = function(event) {

You likely just forgot to close the PHP tag there after <?php echo $_REQUEST['id']; as you are clearly writing javascript on the second lilne.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM