This question already has an answer here:
- Illegal string offset Warning PHP 14 answers
- Reference - What does this error mean in PHP? 34 answers
i have a problem with illegal string offset
how to fixed this problem, so many way i'm trying but it's not solved.
this's my code:
<?php
include "config/koneksi.php";
$dlpenyakit = $_POST['Gejala'];
echo json_encode($dlpenyakit);
foreach($dlpenyakit as $ddata){
$sql = "SELECT * FROM rule where idGejala=$ddata";
$diagnosaa = mysql_query($sql) or exit("Error query: <b>".$sql."</b>.");
foreach(mysql_fetch_assoc($diagnosaa) as $data2)
{
$rl = $data2['idPenyakit'];
$sql = "SELECT * FROM rule where idPenyakit=$rl";
$rulee = mysql_query($sql) or exit("Error query: <b>".$sql."</b>.");
$jml_prob = 1;
foreach (mysql_fetch_assoc($rulee) as $data4)
{
$probb = $data4['Probabilitas_gejala'];
echo $probb;
// perkalian prob gejala
$jml_prob = $jml_prob*$probb;
echo ' = '.$jml_prob;
echo "<br>";
}
?>
thank you
</div>