getstory1.php 722 B

1234567891011121314151617181920212223242526272829
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <body>
  5. <?php include 'submitdatabaseinfo1.php';?>
  6. <?php
  7. $primarykey = $_GET['primarykey'];
  8. // Create connection
  9. $conn = mysqli_connect($servername, $username, $password, $dbname);
  10. mysqli_set_charset($conn, "utf8");
  11. // Check connection
  12. if (!$conn) {
  13. die("Database connection failed: " . mysqli_connect_error());
  14. }
  15. $sql = "SELECT title, story FROM originalstories WHERE primarykey = '".$primarykey."'";
  16. $result = mysqli_query($conn,$sql);
  17. $rows = mysqli_num_rows($result);
  18. while($row = mysqli_fetch_array($result)){
  19. $txt = wordwrap($row["story"],70);
  20. echo "<h2>" . $row["title"] . "</h2><br><br><pre>" . $txt . "</pre>";
  21. }
  22. mysqli_close($conn);
  23. exit;
  24. ?>
  25. </body>
  26. </html>