-2

after researching and debugging, i cant seem to find the cause of this error.

<!doctype html>
<html>
<head>
  <title>hquirit | Home</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="style.css"/>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
</head>
<body>
  <?php

    $servername = "localhost";
    $dbuser = "id1147793_hquirit";
    $dbname = "id1147793_bukkitplugins";
    $password = "5mHgq9quirr421";

    $connect = mysqli_connect($servername, $dbuser, $password, $dbname);

    if (!$connect) {
      die("Connection failed: " . mysqli_connect_error());
    }

    $query = "SELECT name, downloads, upload_date FROM bukkit_plugins";
    $result = $connect->query($query);

    echo "<div class='container'>";
    echo "<div class=table-responsive'>";
    echo "<table class='table tabled-bordered table-hover table-condensed'>";
    echo "<thead>";
    echo "<tr>";
    echo "<th>Plugin Name</th><th>Downloads</th><th>Upload Date</th>";
    echo "</tr>";
    echo "</thead>";
    echo "<tbody>";
            if ($result->num_rows > 0) {
              while ($row = $result->fetch_assoc()) {
                echo "<tr>";
                echo "<td>" . $row['name'] . "</td><td>" . $row['downloads'] . "</td><td>" . $row['upload_date'] . "</td>";
                echo "</tr>";
            }
    echo "</tbody>";
    echo "</table>";
    echo "</div>";
    echo "</div>";

  ?>

</body>
</html>

every part of the code works, so when i try to view the page on webhost, an error "Parse error: syntax error, unexpected end of file in /storage/ssd2/793/1147793/public_html/bukkit_plugins.php on line 53" comes up (line 53 being the end of the html tag).

henny888
  • 1
  • 1
  • 4

3 Answers3

0
if ($result->num_rows > 0) {
          while ($row = $result->fetch_assoc()) {
            echo "<tr>";
            echo "<td>" . $row['name'] . "</td><td>" . $row['downloads'] . "</td><td>" . $row['upload_date'] . "</td>";
            echo "</tr>";
            }
        }

You haven't close if loop that's why getting error....

Dhruvang Gajjar
  • 568
  • 1
  • 8
  • 20
0

Please change this

echo "<tbody>";
        if ($result->num_rows > 0) {
          while ($row = $result->fetch_assoc()) {
            echo "<tr>";
            echo "<td>" . $row['name'] . "</td><td>" . $row['downloads'] . "</td><td>" . $row['upload_date'] . "</td>";
            echo "</tr>";
        }
echo "</tbody>";



  to  

    echo "<tbody>";
            if ($result->num_rows > 0) {
              while ($row = $result->fetch_assoc()) {
                echo "<tr>";
                echo "<td>" . $row['name'] . "</td><td>" . $row['downloads'] . "</td><td>" . $row['upload_date'] . "</td>";
                echo "</tr>";
              }
            }
    echo "</tbody>";

You just forgot a "}" before tbody print.

Ranjit
  • 1,684
  • 9
  • 29
  • 61
0

Bootstrap needs Tether, so you need to include tether.min.js before you include bootstrap.min.js

Try adding these two lines before bootstrap.min.js

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>

Nikhil Parmar
  • 495
  • 3
  • 17