Guest User

Untitled

a guest
Feb 2nd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  2. <title>Grafik Penduduk Indonesia</title>
  3. <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  4. <script src="http://code.highcharts.com/highcharts.js"></script>
  5. <script src="http://code.highcharts.com/modules/exporting.js"></script>
  6. <script type="text/javascript">
  7.   var chart1; // globally available
  8. $(document).ready(function() {
  9.       chart1 = new Highcharts.Chart({
  10.          chart: {
  11.             renderTo: 'container',
  12.             type: 'column'
  13.          },  
  14.          title: {
  15.             text: 'Data Pasien Menurut Jenis Kelamin'
  16.          },
  17.          xAxis: {
  18.             categories: ['Jenis Kelamin']
  19.          },
  20.          yAxis: {
  21.             title: {
  22.                text: 'Jumlah Pasien'
  23.             }
  24.          },
  25.               series:            
  26.             [
  27. <?php
  28.            
  29. $server = "localhost";
  30. $username = "root";
  31. $password = "";
  32. $database = "rs.paru";
  33. mysql_connect($server,$username,$password) or die("Koneksi gagal");
  34. mysql_select_db($database) or die("Database tidak bisa dibuka");
  35. $sql   = "SELECT distinct jeniskelaminPasien from pasien group by jeniskelaminPasien";
  36. $query = mysql_query( $sql )  or die(mysql_error());
  37.  
  38.        
  39. while($ambil = mysql_fetch_array($query)){
  40.   $jeniskelaminPasien=$ambil['jeniskelaminPasien'];
  41.   $sql_jumlah   = "SELECT count(*) from pasien where jeniskelaminPasien='$jeniskelaminPasien'";        
  42.   $query_jumlah = mysql_query( $sql_jumlah ) or die(mysql_error());
  43.   while( $data = mysql_fetch_array( $query_jumlah ) ){
  44.      $jumlahx = $data['jeniskelaminPasien'];                
  45.     }            
  46.    
  47.     ?>
  48.     {
  49.       name: '<?php echo $jeniskelaminPasien; ?>',
  50.       data: [<?php echo $jumlahx; ?>]
  51.     },
  52.     <?php } ?>
  53. ]
  54. });
  55. });
  56. </script>
Add Comment
Please, Sign In to add comment