gettitles.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <body>
  5. <?php include 'submitdatabaseinfo.php';?>
  6. <?php
  7. $lang = $_GET['lang'];
  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, primarykey FROM stories WHERE checked = 'yes' AND language = '".$lang."'";
  16. $result = mysqli_query($conn,$sql);
  17. $rows = mysqli_num_rows($result);
  18. if ( $rows > 0 ) {
  19. echo "<tr><th></th><th>Choose the title of the story you wish to read</th></tr>";
  20. while($row = mysqli_fetch_array($result)){
  21. echo "<tr> <td> <input type='radio' name='storytitles' value='" . $row["primarykey"] . "' onclick='getstory(" . $row["primarykey"] . ")'> </td> <td id='" . $row["primarykey"] . "'>" . $row["title"] . "</td></tr>";
  22. }
  23. } else {
  24. echo "<tr><th></th><th>There are no stories in this language</th></tr>";
  25. }
  26. mysqli_close($conn);
  27. exit;
  28. ?>
  29. </body>
  30. </html>