lundi 29 octobre 2018

Increasing the value printed

i wrote this code and I want to increase the printed value but the next value is increasing one. For example program choosed value "Anıl Efe Çoban" and it should increase one to "Anıl Efe Çoban" ' s value. But it increasing next rand's value. I can not find the error, Where is the problem? Im waiting your answers.

$deger = 0;
echo "<div align= 'center'>";
echo "<h2> Birini Seçmek Zorundasın </h2>";
echo "</div>";
$kisiler= Array("Anıl Efe Çoban", "Mert Yüksel", "Emre Çelik", "Eren 
Şimşek", "Yiğit Gölebatmaz");
$kisiler_rand= $kisiler[array_rand($kisiler)]; # random chosing
$kisiler_randd= $kisiler_rand;
echo "<div id= 'karsilastirma1'>";
echo "</div>";
echo "<br>";
echo "<div align= 'center'>";
echo $kisiler_randd;
echo "<form method= 'POST'>";
echo "<br>";
echo "<input type= 'submit' name= 'cekici' value= 'Çekici'>". " ";
echo "<input type= 'submit' name= 'zeki' value= 'Zeki'>". " ";
echo "<input type= 'submit' name= 'dedikoducu' value= 'Dedikoducu'>". " ";
echo "<input type= 'submit' name= 'neseli' value= 'Neşeli'>". " ";


if($kisiler_randd== "Anıl Efe Çoban"){ # What is the randd
        if(isset($_POST['cekici'])){
            $sql= "SELECT * FROM benalmash WHERE isim= 'Anil_cekicilik';"; 
            $result= mysqli_query($baglan, $sql);
            $resultCheck= mysqli_num_rows($result);
            if($resultCheck > 0){
                $row= mysqli_fetch_assoc($result);
                $deger= $row["deger"];
                $deger++;
                $sqll= "UPDATE benalmash SET deger= $deger WHERE isim= 
     'Anil_cekicilik';";
                $istek= mysqli_query($baglan, $sqll);
        }
    }
}


    if($kisiler_randd== "Emre Çelik"){
       if(isset($_POST['cekici'])){
        $sql= "SELECT * FROM benalmash WHERE isim= 'Emre_cekicilik';"; 
        $result= mysqli_query($baglan, $sql);
        $resultCheck= mysqli_num_rows($result);
        if($resultCheck > 0){
        $row= mysqli_fetch_assoc($result);
        $deger= $row["deger"];
        $deger++;
        $sqll= "UPDATE benalmash SET deger= $deger WHERE isim= 
      'Emre_cekicilik';";
        $istek= mysqli_query($baglan, $sqll);
        }
    }
}


if($kisiler_randd== "Eren Şimşek"){
    if(isset($_POST['cekici'])){
        $sql= "SELECT * FROM benalmash WHERE isim= 'Eren_cekicilik';"; 
        $result= mysqli_query($baglan, $sql);
        $resultCheck= mysqli_num_rows($result);
        if($resultCheck > 0){
            $row= mysqli_fetch_assoc($result);
            $deger= $row["deger"];
            $deger++;
            $sqll= "UPDATE benalmash SET deger= $deger WHERE isim= 
    'Eren_cekicilik';";
            $istek= mysqli_query($baglan, $sqll);
        }
    }
}


if($kisiler_randd== "Yiğit Gölebatmaz"){
    if(isset($_POST['cekici'])){
        $sql= "SELECT * FROM benalmash WHERE isim= 'Yigit_cekicilik';"; 
        $result= mysqli_query($baglan, $sql);
        $resultCheck= mysqli_num_rows($result);
        if($resultCheck > 0){
            $row= mysqli_fetch_assoc($result);
            $deger= $row["deger"];
            $deger++;
            $sqll= "UPDATE benalmash SET deger= $deger WHERE isim= 
     'Yigit_cekicilik';";
            $istek= mysqli_query($baglan, $sqll);
        }
    }
}




Aucun commentaire:

Enregistrer un commentaire