Advertisement
andreasrk

Untitled

Apr 13th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1.          <?php
  2. $servername = "localhost";
  3. $username = "admin";
  4. $password = "xxxxxx";
  5. $dbname = "module3";
  6.  
  7. // Create connection
  8. $conn = mysqli_connect($servername, $username, $password, $dbname);
  9. // Check connection
  10. if (!$conn) {
  11.     die("Connection failed: " . mysqli_connect_error());
  12. }
  13.  
  14. $sql = "SELECT title, link, area, shortdesc, period, id FROM tabella_file";
  15.  
  16. $result = mysqli_query($conn, $sql);
  17.    
  18.  
  19. if (mysqli_num_rows($result) > 0) {
  20.     // output data of each row
  21.     while($row = mysqli_fetch_assoc($result)) {
  22.        
  23.  
  24.        
  25.            echo  "TITLE: " . $row["title"]. "-SHORTDESC: ". $row["shortdesc"].$row["period"]. "<a href=\""  . $row['link'] . "\" >" . "GO TO THE PROJECT" . '</a>'."<br>";
  26.        
  27.     }
  28. } else {
  29.     echo "0 results";
  30. }
  31.  
  32. mysqli_close($conn);
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement