My webpage does not work... please help!

Discussion in 'Programming' started by FlenscrafterHD, Oct 9, 2019 at 10:49 AM.

  1. Hello guys,
    I am programming an Admin Panel where you can see Projects of all users

    PHP:
    <?php
      include "../configs/mysql.php";

      $status = "";

      if(isset($_SESSION['secretkey'])){

        $sql = "SELECT * FROM 'Projects'";

        $result = mysqli_query($conn, $sql);

        if (mysqli_num_rows($result) > 0) {
            // output data of each row
            while($row = mysqli_fetch_assoc($result)) {

              if($row['status'] == 0){
                $status = "<span style='color:red;'> » Bestellt</span>";
              } else if($row['status'] == 1){
                $status = "<span style='color:orange;'> » In Bearbeitung</span>";
              } else if($row['status'] == 2){
                $status = "<span style='color:green;'> » Fertig</span>";
              }

              if($row['paid'] == 0){
                if($row['status'] == 0){
                  echo "<div class='projects_item_unpaid'><h1>".$row['productname'].$status."</h1><p>".$row['description']."</p><form action='adminprojects.php' method='post'><input type='text' name='id' hidden value='".$row['id']."'><input type='submit' name='setpaid' value='Bezahlt'></form><form action='adminprojects.php' method='post'><input type='text' name='id' hidden value='".$row['id']."'><input type='text' name='status' hidden value='1'><input type='submit' name='setstatus' value='In Bearbeitung'></form><form action='adminprojects.php' method='post'><input type='text' name='id' hidden value='".$row['id']."'><input type='text' name='status' hidden value='2'><input type='submit' name='setstatus' value='Fertig'></form></div>";
                } else {
                  echo "<div class='projects_item_unpaid'><h1>".$row['productname'].$status."</h1><p>".$row['description']."</p><a href='".$row['payment_url']."'><i class='fas fa-money-bill-alt'></i> Bezahlen</a></div>";
                }
              } else {
                echo "<div class='projects_item_paid'><h1>".$row['productname'].$status."</h1><p>".$row['description']."</p><a href='".$row['download_url']."'><i class='fas fa-file-download'></i> Download</a></div>";
              }
            } else {
              echo "<div class='error_display'><h1>Es wurden keine Projekte gefunden</h1></div>";
            }
          } else {
            echo "<div class='error_display'><h1>Es wurden keine Projekte gefunden</h1></div>";
          }
        } else {
          echo "<div class='error_display'><h1>Die Benutzerdaten konnten nicht angefordert werden!<h1><h3>Bitte versuche die Seite neuzuladen</h3></div>";
        }

    ?>
    BTW I am german, so don't mind the Messages.
    This Code give me an HTML 500 Error and I dont see the error… can you please look over my Code and help me please :)
     
  2. Just making sure, you initialized the $conn right? You are 100% sure the connection is open, and functioning?
     
  3. Yeah I am sure... but thanks for your reply!
     
  4. Strahan

    Benefactor

    You should also enable logging so you can get actually useful error messages instead of just "error 500".
     
  5. How can I do that?
     
  6. Thnaks for your help! I tried yours and now all works totally fine!