Advertisement
GuizzardiG

Untitled

Apr 13th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password = "";
  5. $dbname = "xxx";
  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. echo "<table border=1>
  25. <tr>";
  26. echo "<td>TITLE: " . $row["title"]. "</td><td>SHORTDESC: ". $row["shortdesc"]."</td><td>".$row["period"]. "</td><td><a href=\"" . $row['link'] . "\" >" . "GO TO THE PROJECT" . '</a>'."<br>";
  27.  
  28. echo " </tr>
  29. </table>";
  30. }
  31. } else {
  32. echo "0 results";
  33. }
  34.  
  35. mysqli_close($conn);
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement