mercredi 12 juillet 2017

while and if , else combination

I try to extract data from database below, and as a result, for example, as below is low risk, I want to show an image and, at average risk, another image. But it does not work. What is wrong?

<?php
 
if ($_POST){
    $ara=$_POST["ara"];
        
    $sorgu=mysqli_query($baglan, "select Risk from wanbetaler where BTW like '%$ara%'");
    if (empty($ara)){
        echo 'GEEN RESULTAAT';
    }else{
        if (mysqli_num_rows($sorgu)>0){
            while($kayit=mysqli_fetch_array($sorgu)){
                                if ($kayit = "Low risk" ){
                                        
                                        echo '<center> <img src="groen.jpg" class="center" /></center>';
                                
                                }elseif ($kayit = "Average risk" ){
                                        
                                        echo '<center> <img src="oranje.JPG" class="center" /></center>';
                                
                                }
        
                        }
        }else{
            echo 'GEEN RESULTAAT';
        }
    }
}else{
        
        }
?>

Aucun commentaire:

Enregistrer un commentaire