Advertisement
Guest User

database.php

a guest
Sep 17th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. <script src="plugin/jquery-3.2.1.js"></script>
  2. <script src="plugin/datatables.min.js"></script>
  3. <link href="plugin/datatables.min.css" rel="stylesheet">
  4. <script src="plugin/canvasjs.min.js"></script>
  5. <script srrc="plugin/jqBarGraph.1.1.js"></script>
  6. <?php
  7.     $server = "localhost";
  8.     $username = "root";
  9.     $password = "";
  10.     $dbname = "quiz1";
  11.     $conn = new mysqli($server, $username, $password, $dbname);
  12.  
  13.     $que = "SELECT ClassCode, ClassName, FirstName, LastName, Score FROM class c, studentclass sc, students s WHERE c.ID=sc.ClassID AND s.ID=sc.StudentID ";
  14.         $result = $conn->query($que);
  15.         echo"
  16.         <script>
  17.         $(document).ready(function() {
  18.             $('#example').DataTable();
  19.         })
  20.         </script>
  21.         <html>
  22.             <head>
  23.                 <title> EXAMPLE </title>
  24.             </head>
  25.             <body>
  26.                 <table id='example' class='display' cellspacing='0' width='100%'>
  27.                         <thead>
  28.                             <tr>
  29.                                 <th>Firstname</th>
  30.                                 <th>lastname</th>
  31.                                 <th>classname</th>
  32.                                 <th>Score</th>
  33.                             </tr>
  34.                         </thead>
  35.                         <tbody>
  36.         ";
  37.         while($row = $result->fetch_assoc()){
  38.                 $classcode = $row["ClassCode"];
  39.                 $classname = $row["ClassName"];
  40.                 $firstname = $row["FirstName"];
  41.                 $lastname = $row["LastName"];
  42.                 $score = $row["Score"];
  43.                 echo"
  44.                     <tr>
  45.                         <td>$firstname</td>
  46.                         <td>$lastname</td>
  47.                         <td>$classname</td>
  48.                         <td>$score</td>
  49.                     </tr>
  50.                 ";
  51.         echo json_encode($firstname);
  52.         }
  53.         echo"
  54.                         </tbody>
  55.                 </table>
  56.             <script>
  57.             </script>
  58.             </body>
  59.         </html>
  60.         ";             
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement