0

ich had Programm this code. It`s in principle the same as in a tutorial. Maybe you see me issue. The connectin to the Database is successful.

In the PHP tag i have a echo with 'Test'. This echo runs. I cant see all HTML Tags after this.

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <link href="http://fonts.google.com/css?family=Lato:300,400" rel="stylesheet"type="text/css">
    <link href="https://fonts.google.com/css?family=Oswald:700,400" rel="stylesheet"type="text/css">
    <title>Online Predigt</title>
 
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
    <!--<link rel="stylesheet" href="css/audioplayer.css">-->
 
  </head>
  <body>
    <?php
    echo "Test";
        require("inc/db_connect.php");
       
        $abfrage = "SELECT * FROM online_predigten ORDER BY ID DESC LIMIT 5";
        $ergebnis = mysqli_query($abfrage);
        while ($row = mysqli_fetch_object($ergebnis)) {
          ?>
          <div id="audiobox">
            <div id="infos">
              <h3 id="titel"><?php echo $row->titel; ?><h3><br>
              <p id="prediger"><?php echo $row->prediger; ?></p><br>
              <p id="datum"><?php echo $row->datum; ?></p><br>
              <img src="<?php echo $row->img_pfad; ?>" alt="Prediger" height="100" width="100"><br>
            </div>
 
 
            <div id="audioplayer">
              <audio  controls>
                <src="<?php echo $row->audio_pfad; ?>" type="audio/mpeg"><br>
 
              </audio>
            </div>
 
          </div>
 
          <?php
        }
 
    ?>
 
 
  </body>
</html>

Blessed Adrian

Adrian
  • 135
  • 1
  • 3
  • 12
  • Sure your connection is successfull? Because it SQL don't return any data its normal you won't see anything, cause the whole while loop won't be executed... so, sure you havent an error in the connection? – Twinfriends Oct 13 '16 at 09:31
  • Oh i see. You have a syntax error in your mysqli_* Take a look at this: http://www.w3schools.com/php/func_mysqli_query.asp Format: mysqli_query(connection,query,resultmode); -> You're missing the $con parameter. Its the variable you initialized in your db_connect.db – Twinfriends Oct 13 '16 at 09:34
  • Verbindung zum MySQL Server fehlgeschlagen: '.mysqli_connect_error().''; } else { echo '

    Verbindung zum MySQL Server erfolgreich aufgebaut.

    '; } ?> I deleted the the DB Data, but thats the db_connect.db so for the msqli_query i have to write this?: $ergebnis = mysqli_query("SELECT * FROM online_predigten ORDER BY ID DESC LIMIT 5");
    – Adrian Oct 13 '16 at 09:41
  • You have to transmitt your $connect variable. If you would have take a look at my posted link you would have found this solution by yourself $ergebnis = mysqli_query($conect,"SELECT * FROM online_predigten ORDER BY ID DESC LIMIT 5"); Thats all. – Twinfriends Oct 13 '16 at 09:47
  • Have you just copy pasted my answer, or did you realize my typo ..? i wrote $conect instead of $connect ... my bad sorry. Have you seen this? – Twinfriends Oct 13 '16 at 09:55
  • Just copyed .D now it works :D Thank You :-) – Adrian Oct 13 '16 at 09:56
  • You're welcome. :) Never trust internetusers haha:P Wünsche dir noch einen schönen Tag. Mal bisschen Deutsch reinbringen. :P – Twinfriends Oct 13 '16 at 09:59

0 Answers0