CrazyDiamond

PHP skripts kontroljautājumu un atbilžu izvadīšanai:

Jun 16th, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.66 KB | None | 0 0
  1. <html>
  2. <head></head>
  3. <body>
  4. <?php
  5.     header("Content-Type: text/html; charset = utf-8");
  6.         //data with connection info
  7.         include'inc.db.Questions.php';
  8.  
  9.       // Create connection
  10.       $conn = new mysqli($servername, $username, $password, $dbname);
  11.       // Check connection
  12.       if ($conn->connect_error) {
  13.           die("Connection failed: " . $conn->connect_error);
  14.       }
  15.  
  16.     mysqli_set_charset($conn, "utf8");
  17.       $sql = "SELECT id, question FROM NetworkQuestions WHERE variant = '4.4'";
  18.       $result = $conn->query($sql);
  19. //  $result = mysqli_querry($conn, "SELECT id, quastion FROM NetworkQuastions");
  20.       if ($result->num_rows > 0) {
  21.           // output data of each row
  22.           while($row = $result->fetch_assoc()) {
  23.              // echo "<b>id at </b> " . $row["id"]. "<b> -></b> " . $row["question"]. "<br>";    
  24.           print"<b>{$row["question"]}</b><br><br>";        
  25.         echo"<hr>";
  26.        
  27.         //show all answers script
  28.             $Questions_ID=$row["id"];
  29.         //echo"<p>".$Questions_ID." </p> ";
  30.     //echo"<br>";
  31.          include "CommentsShow2.php";
  32.         //echo"<p>Another test string</p>";
  33.         //echo"<br><hr>";
  34.         //insert script tag
  35.     //    readfile('button.html');
  36.         print"<form method ='POST' action= 'Com.Insert.Q.php'>
  37.         <input type ='hidden' name = 'qid' value =' $Questions_ID' >
  38.         <textarea name= 'text' cols = '66' rows = '2'></textarea>
  39.                 <button type= 'submit' name = 'submitComment'>Fail?</button>
  40.         </form>";      
  41.         echo"<hr>";
  42.         echo"<hr>";
  43.         echo"<hr>";
  44.         echo"<br>";
  45.     }
  46.       } else {
  47.           echo "0 results of Finding Questions";
  48.       }
  49.       $conn->close();
  50.  
  51.     ?>
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment