Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <html>
  2. <?php // content="text/plain; charset=utf-8"
  3. require_once ('src/jpgraph.php');
  4. require_once ('src/jpgraph_line.php');
  5. require_once ('src/jpgraph_error.php');
  6.  
  7.  
  8. $dbc = pg_connect("host=localhost dbname=u2route user=postgres password=yuliana port=5432");
  9. if (!$dbc) {
  10.     die("Error in connection: " . pg_last_error());
  11. }
  12.  
  13. // Connect to the database
  14.  
  15.  
  16.     $psql2 = "SELECT bytes, time FROM frames";
  17.     $resultpsql2 = pg_query($dbc, $psql2);
  18.  //    echo $psql2."<br>";
  19.     if (!$resultpsql2) {
  20.     die("Error in SQL query: " . pg_last_error()); }
  21.     while ($datapsql = pg_fetch_array($resultpsql2)) {
  22.         $bytes[] = $datapsql[0];
  23.         $time[] = floatval($datapsql[1]);
  24.     }
  25.    
  26. //echo $bytes[2];
  27. // Some (random) data
  28.  
  29.  
  30. // Size of the overall graph
  31. $width=500;
  32. $height=250;
  33.  
  34. // Create the graph and set a scale.
  35. // These two calls are always required
  36. $graph = new Graph($width,$height);
  37. $graph->SetScale('int');
  38.  
  39. // Create the linear plot
  40. $lplot=new LinePlot($bytes, $time);
  41.  
  42. // Add the plot to the graph
  43. $graph->Add($lplot);
  44. ?>
  45.  
  46.  
  47. <body>
  48.  
  49. <!-- Aqui va el codigo de los tabs -->
  50.   <?php
  51.   // Display the graph
  52.   $graph->Stroke()
  53.   ?>
  54. <!-- Aqui termina el codigo de los tabs -->
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement