Reputation: 51
i tried to set the value of the $_GET[] into an array object
this is my code
$X=array(
'status_1'=>'"'.$_GET['hasil_1'].'"',
'status_2'=>'"'.$_GET['hasil_2'].'"',
'status_3'=>'"'.$_GET['hasil_3'].'"',
.
.
'status_17'=>'"'.$_GET['hasil_17'].'"');
//Faktor Klasifikasi
$n = 'derajat';
//nama tabel
$table='tabel';
classify($X,$n,$table);
it's not working .
this is the url
http://localhost:8080/tugas/sispak/hasil.php?hasil_1=1&hasil_2=1&hasil_3=1&hasil_4=1&hasil_5=1&hasil_6=0&hasil_7=1&hasil_8=1&hasil_9=0&hasil_10=1&hasil_11=1&hasil_12=1&hasil_13=1&hasil_14=1&hasil_15=1&hasil_16=1&hasil_17=1
but , if i write it manualy like
$Y=array(
'status_1'=>'1',
'status_2'=>'1',
'status_3'=>'1',
.
.
'status_17'=>'1'
);
it works !!
this is where I handle the values of my array
//var_dump($allclass);
foreach($allclass as $c=>$p)
{
foreach($X as $x=>$y)
{
$i = mysql_query("select count(*) as num from ".$table." where ".$n."='".$c."' AND ".$x."='".$y."'");
$j = mysql_fetch_array($i,MYSQL_ASSOC);
$P[$c][$x] = round($j["num"]/$allclass[$c],2);
//Exception: P(data/class) might be 0 in some cases, ignore 0 for now
if($P[$c][$x] != 0)
$argmax[$c] *= $P[$c][$x];
}
$argmax[$c] *= $Pc[$c];
}
somebody help me ,please
Upvotes: 1
Views: 114
Reputation: 21789
You dont need all those quotes, try as follows:
$X = array(
'status_1'=> $_GET['hasil_1'],
'status_2'=> $_GET['hasil_2'],
'status_3'=> $_GET['hasil_3']
);
Upvotes: 4