Postingan lainnya
Code Web tidak sesuai
Halo, saya ingin membuat Web SPK(Sistem Pendukung Keputusan) dengan metode SMART menggunakan studi kasus perankingan namun saya bingung membuat code dengan rumus :
Screenshot (181).png
Sehingga nilai Akhir bisa ditemukan sesuai rumus diatas :
Screenshot (182).png
dan code yang saya lakukan tidak sesuai :
Screenshot (183).png
Mohon Bantuan nya berikut kode eksekusi nya :
<?php
include "header.php";
$page = isset($_GET['page'])?$_GET['page']:"";
?>
<div class="row cells4">
<div class="cell colspan2">
<h3>Eksekusi Perangkingan</h3>
</div>
<div class="cell colspan2 align-right">
<a href="perangkingan.php" class="button info">Kembali</a>
</div>
</div>
<table class="table striped hovered cell-hovered border bordered dataTable" data-role="datatable" data-searching="true">
<thead>
<tr>
<th width="50">No</th>
<th>Alternatif</th>
<?php
$stmt2x = $db->prepare("select * from smart_kriteria");
$stmt2x->execute();
while($row2x = $stmt2x->fetch()){
?>
<th><?php echo $row2x['nama_kriteria'] ?></th>
<?php
}
?>
<th>Nilai Akhir</th>
<th>Ranking</th>
</tr>
</thead>
<tbody>
<tr>
<td>-</td>
<td>Bobot</td>
<?php
$stmt2x1 = $db->prepare("select * from smart_kriteria");
$stmt2x1->execute();
while($row2x1 = $stmt2x1->fetch()){
?>
<td><?php echo $row2x1['bobot_kriteria'] ?></td>
<?php
}
?>
<td>-</td>
<td>-</td>
</tr>
<?php
$stmtx = $db->prepare("select * from smart_alternatif");
$noxx = 1;
$stmtx->execute();
while($rowx = $stmtx->fetch()){
?>
<tr>
<td><?php echo $noxx++ ?></td>
<td><?php echo $rowx['nama_alternatif'] ?></td>
<?php
$stmt3x = $db->prepare("select * from smart_kriteria");
$stmt3x->execute();
while($row3x = $stmt3x->fetch()){
?>
<td>
<?php
$stmt4x = $db->prepare("select * from smart_alternatif_kriteria where id_kriteria='".$row3x['id_kriteria']."' and id_alternatif='".$rowx['id_alternatif']."'");
$stmt4x->execute();
while($row4x = $stmt4x->fetch()){
$ida = $row4x['id_alternatif'];
$idk = $row4x['id_kriteria'];
echo $kal_2 = $row4x['nilai_alternatif_kriteria']*0.247*$row3x['bobot_kriteria'];
$stmt2x3 = $db->prepare("update smart_alternatif_kriteria set bobot_alternatif_kriteria=? where id_alternatif=? and id_kriteria=?");
$stmt2x3->bindParam(1,$kal);
$stmt2x3->bindParam(2,$ida);
$stmt2x3->bindParam(3,$idk);
$stmt2x3->execute();
}
?>
</td>
<?php
}
?>
<td>
<?php
$stmt3x2 = $db->prepare("select sum(bobot_alternatif_kriteria) as bak from smart_alternatif_kriteria where id_alternatif='".$rowx['id_alternatif']."'");
$stmt3x2->execute();
$row3x2 = $stmt3x2->fetch();
$ideas = $rowx['id_alternatif'];
echo $hsl = $row3x2['bak'];
if($hsl>=0.9){
$ket = "1";
} else if($hsl>=0.8){
$ket = "2";
} else if($hsl>=0.7){
$ket = "3";
} else if($hsl>=0.6){
$ket = "4";
} else if($hsl>=0.5){
$ket = "5";
} else if($hsl>=0.4){
$ket = "6";
} else if($hsl>=0.3){
$ket = "7";
} else if($hsl>=0.2){
$ket = "8";
} else{
$ket = "9";
$ket = "10";
$ket = "11";
$ket = "12";
$ket = "13";
$ket = "14";
$ket = "15";
}
$stmt2x3y = $db->prepare("update smart_alternatif set hasil_alternatif=?, ket_alternatif=? where id_alternatif=?");
$stmt2x3y->bindParam(1,$hsl);
$stmt2x3y->bindParam(2,$ket);
$stmt2x3y->bindParam(3,$ideas);
$stmt2x3y->execute();
?>
</td>
<td>
<?php
if($hsl>=0.9){
$ket2 = "1";
} else if($hsl>=0.8){
$ket2 = "2";
} else if($hsl>=0.7){
$ket2 = "3";
} else if($hsl>=0.6){
$ket2 = "4";
} else if($hsl>=0.5){
$ket2 = "5";
} else if($hsl>=0.4){
$ket2 = "6";
} else if($hsl>=0.3){
$ket2 = "7";
} else if($hsl>=0.2){
$ket2 = "8";
} else{
$ket2 = "9";
$ket2 = "10";
$ket2 = "11";
$ket2 = "12";
$ket2 = "13";
$ket2 = "14";
$ket2 = "15";
}
echo $ket2;
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<p><br/></p>
<?php
include "footer.php";
?>
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban