Advertisement
Guest User

Untitled

a guest
Mar 20th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Leaderbord Warface</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15" />
  6. <?php
  7. include 'index.php';
  8. include 'function.php';
  9.  
  10. $servername = "localhost";
  11. $username = "root";
  12. $password = "";
  13. $dbname = "myDB";
  14.  
  15. // Create connection
  16. $conn = new mysqli($servername, $username, $password, $dbname);
  17. // Check connection
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22. $sqlCLAN = "SELECT DISTINCT nome_clan FROM leaderboard";
  23. $resultCLAN = $conn->query($sqlCLAN);
  24. if ($resultCLAN->num_rows > 0) {
  25. ?>
  26. <!-- load api -->
  27. <script type=botrugno"text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
  28. <script type="text/javascript">
  29. google.charts.load('current', {'packages':['line']});
  30. google.charts.setOnLoadCallback(drawChart);
  31.  
  32. function drawChart() {
  33. <?php
  34. while( $rowCLAN = $resultCLAN->fetch_assoc() ){
  35. extract($rowCLAN);
  36. ?>
  37. var data = new google.visualization.DataTable();
  38. data.addColumn('date', 'Day');
  39. data.addColumn('number', '<?php echo $nome_clan; ?>');
  40. data.addRows([
  41. <?php
  42. $sql = "SELECT orario, cp FROM leaderboard WHERE nome_clan='$nome_clan'";
  43. $result = $conn->query($sql);
  44. echo $sql;
  45. while( $row = $result->fetch_assoc() ){
  46. extract($row);
  47. echo "[".get_stringa_date($orario).", {$cp}],";
  48. }
  49. ?>
  50. ]);
  51.  
  52. var options = {
  53. chart: {
  54. title: 'Grafico di andamento leaderboard mensile',
  55. subtitle: 'in millions of cp'
  56. },
  57. width: 900,
  58. height: 500
  59. };
  60. var chart = new google.charts.Line(document.getElementById('linechart_material'));
  61. chart.draw(data, options);
  62. <?php
  63. }
  64. ?>
  65. }
  66. </script>
  67. <?php
  68. }else{
  69. echo "No clan found in database.";
  70. }
  71. ?>
  72. </head>
  73. <body style="font-family: Arial;border: 0 none;">
  74. <div id="linechart_material" style="width: 900px; height: 500px"></div>
  75. </body>
  76. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement