예제 #1
0
$data = mysql_fetch_row($q1);
$arr = array();
for ($i = 0; $i <= 4; $i++) {
    ${'g' . $i} = round($data[$i] / $data[5] * 100, 2);
    array_push($arr, ${'g' . $i});
}
$umur = array(array("name" => "Umur", "data" => $arr));
$umur = json_encode($umur);
echo "<script>\n\t\t\t\tvar gft = ['> 45 tahun', '35 - 45 tahun', '25 - 35 tahun','17 - 25 tahun','< 17 tahun'];\n\t\t\t\tvar data_pendidikan = {$umur};\n\t\t\t\tgf('usia','Usia', 'Tahun','bar', gft , data_pendidikan);\n\t\t\t\t</script>";
// END UMUR
// Query Pendidikan
$q2 = mysql_query("SELECT\n\t\t\t\t     COUNT(IF(pendidikan = 1,1,NULL)) AS 'SD',\n\t\t\t\t     COUNT(IF(pendidikan = 2,1,NULL)) AS 'SMP',\n\t\t\t\t     COUNT(IF(pendidikan = 3,1,NULL)) AS 'SMA',\n\t\t\t\t     COUNT(IF(pendidikan = 4,1,NULL)) AS 'D1',\n\t\t\t\t     COUNT(IF(pendidikan = 5,1,NULL)) AS 'D2',\n\t\t\t\t     COUNT(IF(pendidikan = 6,1,NULL)) AS 'D3',\n\t\t\t\t     COUNT(IF(pendidikan = 7,1,NULL)) AS 'D4',\n\t\t\t\t     COUNT(IF(pendidikan = 8,1,NULL)) AS 'S1',\n\t\t\t\t     COUNT(IF(pendidikan = 9,1,NULL)) AS 'S2',\n\t\t\t\t     COUNT(IF(pendidikan = 10,1,NULL)) AS 'S3'\n\t\t\t\t\tFROM (SELECT id_pendidikan AS pendidikan FROM `corez_muzakki`) AS dummy_table\n\t\t\t\t\t");
$r = mysql_fetch_row($q2);
$o_CObject = new CObject();
$o_CObject->i = 'id_pendidikan';
$ar_id_pendidikan = $o_CObject->Object_Array();
$x = array();
$i = 0;
foreach ($ar_id_pendidikan as $value) {
    $x[] = array('name' => $value, 'y' => (int) $r[$i]);
    $i++;
}
$pendidikan = json_encode($x);
// End Pendidikan
// Query Pendapatan
$q4 = mysql_query("SELECT\n\t\t\t\t\t\t\t\tCOUNT(IF(penghasilan = 1,1,NULL)) AS '<1jt',\n\t\t\t\t\t\t\t\tCOUNT(IF(penghasilan = 2,1,NULL)) AS '1-3jt',\n\t\t\t\t\t\t\t\tCOUNT(IF(penghasilan = 3,1,NULL)) AS '3-5jt',\n\t\t\t\t\t\t\t\tCOUNT(IF(penghasilan = 4,1,NULL)) AS '5-10jt',\n\t\t\t\t\t\t\t\tCOUNT(IF(penghasilan = 5,1,NULL)) AS '>10jt',\n\t\t\t\t\t\t\t\tCOUNT(*) AS jmlh_data\n\t\t\t\t\t\t\tFROM (SELECT id_penghasilan AS penghasilan FROM `corez_muzakki`) AS dummy_table\n\t\t\t\t\t\t");
$r2 = mysql_fetch_row($q4);
$arrp = array();
for ($i = 0; $i < 4; $i++) {
    ${'p' . $i} = round($r2[$i] / $r2[5] * 100, 2);
    array_push($arrp, ${'p' . $i});