Guest User

Untitled

a guest
Jul 12th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. ## count.php
  2. <?php
  3. include('db_connect.inc.php');
  4. include('framework.inc.php');
  5. include('charts.php');
  6. $qry=mysql_query("SELECT string FROM count");
  7. $arr=array();
  8. $chart['chart_type']="pie";
  9. while($row=mysql_fetch_assoc($qry)) {
  10. $string = $row['string'];
  11.  
  12.  
  13. $string=trim($string);
  14. $string=explode(",",$string);
  15. foreach ($string as $key) {
  16. if (array_key_exists($key, $arr)) { $arr[$key]++; }
  17. else { $arr[$key] = 1; }
  18.  
  19. }
  20. }
  21.  
  22.  
  23. $chart['chart_data'][0][0]="String";
  24. $chart['chart_data'][0][1]="Int";
  25. $x=1;
  26. foreach ($arr as $key => $int) {
  27.  
  28. $chart['chart_data'][1][$x]=$key;
  29. $chart['chart_data'][2][$x]=$int;
  30. $x++;
  31. }
  32.  
  33.  
  34. dump($chart['chart_data']);
  35. SendChartData ($chart);
  36.  
  37.  
  38. ## chartoutput.php
  39.  
  40. <?php
  41. include('db_connect.inc.php');
  42. include('framework.inc.php');
  43. include('charts.php');
  44. $random=rand(0,522332);
  45.  
  46. echo InsertChart ( "charts.swf", "charts_library", "count.php?nocache=$random", 400, 250 );
Add Comment
Please, Sign In to add comment