Advertisement
Guest User

Untitled

a guest
Jun 7th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5.     <title>Contoh Statistik</title>
  6.  
  7.    
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13.  
  14.  
  15. <?php
  16.  
  17.     require("./FusionChart/Code/PHP/Includes/FusionCharts.php");
  18.  
  19.     require("./adodb.inc.php");
  20.  
  21.    
  22.  
  23.     $color=array();
  24.  
  25.     $color[]='AFD8F8';
  26.  
  27.     $color[]='F6BD0F';
  28.  
  29.     $color[]='8BBA00';
  30.  
  31.     $color[]='008E46';
  32.  
  33.     $color[]='D64646';
  34.  
  35.     $color[]='A186BE';
  36.  
  37.    
  38.  
  39.     #$gid=$_GET["gid"];
  40.  
  41.    
  42.  
  43.     $conn=&ADONewConnection('postgres');
  44.  
  45.     $conn->Connect('localhost','postgres','1234','pendidikan');
  46.  
  47.    
  48.  
  49.     $strXML="<graph caption='Jumlah Bangunan Sekolah per Kecamatan Bogor'>";
  50.  
  51.     $strXML.="xAxisName='Tingkat Sekolah' yAxisName='Jumlah Bangunan Sekolah'";
  52.  
  53.     $strXML.="decimalPrecision='0' formatNumberScale='0'>";
  54.  
  55.    
  56.  
  57.     $recordSet=&$conn->Execute('select kecamatan, jum_sd from t_sd');
  58.  
  59.     if(!$recordSet){
  60.  
  61.         print $conn->ErrorMsg();
  62.  
  63.     }
  64.  
  65.     else{
  66.  
  67.         $i=0;
  68.  
  69.         $lc=sizeof($color);
  70.  
  71.         while(!$recordSet->EOF){
  72.  
  73.             $strXML.="<set name='".$recordSet->fields[1]."' value='".$recordSet->fields[3]."' color='".$color='".$color[$i % $lc]."'"/>";
  74.  
  75.             $recordSet->MoveNext();
  76.  
  77.             $i++;
  78.  
  79.         }
  80.  
  81.     }
  82.  
  83. ?>
  84.  
  85. </body>
  86.  
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement