无法更新php + mysql中的数据

时间:2017-01-18 08:34:07

标签: php mysql

这是我的列表页面

    <?php
    error_reporting(0);
    include ("config.php");
    echo"
    <table border=1 id='kayit'>";
        echo"<tr>
        <th>NO</th>
        <th>KURULUŞ</th>
        <th>KONU</th>
        <th>AD-SOYAD</th>
        <th>MEDENİ HALİ</th>
        <th>TC</th>
        <th>GÜNCELLE</th>
        </tr>";
    $sorgu=mysql_query("select * from form");
    while($kayit=mysql_fetch_array($sorgu)){
        echo"
        <tr>
        <td>{$kayit[id]}</td>
        <td>{$kayit[kurulus]}</td>
        <td>{$kayit[konu]}</td>
        <td>{$kayit[adsoyad]}</td>
        <td>{$kayit[medeni]}</td>
        <td>{$kayit[tc]}</td>
        <td><a href='duzenle.php?id={$kayit[id]}'>GÜNCELLE</a></td>
    </tr>";}
    echo "</table>";

    ?>

this is my edit form

<form name="guncelle" action="guncelle.php" method="post">
<table cellpadding="0" cellspacing="0">
<tr>
<td><input type="text" class="inputs" name="kurulus" placeholder="Kuruluş Adı" value="<?php echo $yazdir["kurulus"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="konu" placeholder="Konu" value="<?php echo $yazdir["konu"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="adsoyad" placeholder="Adı Soyadı" value="<?php echo $yazdir["adsoyad"];?>" /></td>
</tr>
<tr>
<td>
<select name="medeni"  class="inputs" value="<?php echo $yazdir["medeni"];?>">
    <option value="" disabled selected>Medeni Hali</option>
    <option >Evli</option>
    <option >Bekar</option>
</select>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="tc" placeholder="T.C.Kimlik No" value="<?php echo $yazdir["tc"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="yas" placeholder="Yaşı" value="<?php echo $yazdir["yas"];?>" /></td>
</tr>
<tr>
<td>
<select name="mensubiyet" class="inputs" value="<?php echo $yazdir["mensubiyet"];?>">
    <option value="" disabled selected>Mensubiyeti</option>
    <option value="Sivil">Sivil</option>
    <option value="Polis">Polis</option>
    <option value="Asker">Asker</option>
    <option value="Yabancı Uyruklu">Yabancı Uyruklu</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="cinsiyet" class="inputs" value="<?php echo $yazdir["cinsiyet"];?>">
    <option value="" disabled selected>Cinsiyeti</option>
    <option value="Erkek">Erkek</option>
    <option value="Kadın">Kadın</option>
</select>
</td>
</tr>
<tr>
<tr><td><b>Adres</b></td></tr>
<td>
<textarea name="adres" class="inputs"  rows="4" cols="50" value="<?php echo $yazdir["adres"];?>">

</textarea>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="tel" placeholder="Telefon" value="<?php echo $yazdir["tel"];?>" /></td>
</tr>
<tr>
<td>
<select name="cocuk" class="inputs" value="<?php echo $yazdir["cocuk"];?>">
    <option value="" disabled selected>Çocuk Sayısı</option>
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="saglik" class="inputs" value="<?php echo $yazdir["saglik"];?>">
    <option value="" disabled selected>Sağlık Durumu</option>
    <option value="Yatan Hasta - Ağır">Yatan Hasta - Ağır</option>
    <option value="Yatan Hasta - Tedavisi Sürüyor">Yatan Hasta - Tedavisi Sürüyor</option>
    <option value="Taburcu">Taburcu</option>
</select>
</td>
</tr>
<tr>
<td><input id="myText" class="inputs" name="thastane" placeholder="Tedavi Gördüğü Hastane" value="<?php echo $yazdir["thastane"];?>" /></td>
</tr>
<tr>
<td><input id="myText1" class="inputs" name="khastane" placeholder="Kontrole Gittiği Hastane" value="<?php echo $yazdir["khastane"];?>" /></td>
</tr>
<tr>
<td>
<select class="inputs" value="<?php echo $yazdir["ibasvuru"];?>">
    <option value="" disabled selected>İstihdam Başvurusu</option>
    <option value="Kendisi">Kendisi</option>
    <option value="Eşi">Eşi</option>
    <option value="Kızı">Kızı</option>
    <option value="Oğlu">Oğlu</option>
    <option value="Annesi">Annesi</option>
    <option value="Babası">Babası</option>
</select>
</td>
</tr>
<tr>
<td>
<select class="inputs" value="<?php echo $yazdir["istihdam"];?>">
    <option value="" disabled selected>İstihdam Durumu</option>
    <option value="Atandı">Atandı</option>
    <option value="İşlem Devam Ediyor">İşlem Devam Ediyor</option>
    <option value="Daha Sonra Değerlendirecek">Daha Sonra Değerlendirecek</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="ntazminatdurumu" class="inputs" value="<?php echo $yazdir["ntazminatdurumu"];?>" >
    <option value="" disabled selected>Nakdi Tazminat Durumu</option>
    <option value="Ödendi">Ödendi</option>
    <option value="İşlem Devam Ediyor">İşlem Devam Ediyor</option>
</select>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="ntazminat" placeholder="Nakdi Tazminat" value="<?php echo $yazdir["ntazminat"];?>" /></td>
</tr>
<tr>
<td><b>İl Müdürlüğünce Sunulan Hizmetler</b></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="sydv" placeholder="SYDV'den Yapılan Yardımlar" value="<?php echo $yazdir["sydv"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="belediye" placeholder="Belediyeden Yapılan Yardımlar" value="<?php echo $yazdir["belediye"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="sed" placeholder="3 Kat SED Yardımı" value="<?php echo $yazdir["sed"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="cocuk1" placeholder="1. Çocuk İçin Yapılan Yardım" value="<?php echo $yazdir["cocuk1"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="cocuk2" placeholder="2. Çocuk İçin Yapılan Yardım" value="<?php echo $yazdir["cocuk2"];?>" /></td>
</tr>
<tr>
<td>
<select name="maddidurum" class="inputs" value="<?php echo $yazdir["maddidurum"];?>">
    <option value="" disabled selected>Maddi Durum</option>
    <option value="İhtiyaç Sahibidir">İhtiyaç Sahibidir</option>
    <option value="İhtiyacı Yoktur">İhtiyacı Yoktur</option>
</select>
</td>
</tr>
<tr>
<tr><td><b>Açıklama</b></td></tr>
<td>
<textarea name="aciklama"  class="inputs" rows="4" cols="50" value="<?php echo $yazdir["aciklama"];?>" >

</textarea>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="personel" placeholder="Ziyareti Gerçekleştiren Personel" value="<?php echo $yazdir["personel"];?>" /></td>
</tr>
<tr>
<td><input name="id" type="hidden" value="<?php echo $id; ?>" /></td>
</tr>
<tr>
<td><input type="submit" name="gonder" value="Güncelle" /></td>
</tr>
</table>
</form>

这是我的编辑页面

<form name="guncelle" action="guncelle.php" method="post">
<table cellpadding="0" cellspacing="0">
<tr>
<td><input type="text" class="inputs" name="kurulus" placeholder="Kuruluş Adı" value="<?php echo $yazdir["kurulus"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="konu" placeholder="Konu" value="<?php echo $yazdir["konu"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="adsoyad" placeholder="Adı Soyadı" value="<?php echo $yazdir["adsoyad"];?>" /></td>
</tr>
<tr>
<td>
<select name="medeni"  class="inputs" value="<?php echo $yazdir["medeni"];?>">
    <option value="" disabled selected>Medeni Hali</option>
    <option >Evli</option>
    <option >Bekar</option>
</select>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="tc" placeholder="T.C.Kimlik No" value="<?php echo $yazdir["tc"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="yas" placeholder="Yaşı" value="<?php echo $yazdir["yas"];?>" /></td>
</tr>
<tr>
<td>
<select name="mensubiyet" class="inputs" value="<?php echo $yazdir["mensubiyet"];?>">
    <option value="" disabled selected>Mensubiyeti</option>
    <option value="Sivil">Sivil</option>
    <option value="Polis">Polis</option>
    <option value="Asker">Asker</option>
    <option value="Yabancı Uyruklu">Yabancı Uyruklu</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="cinsiyet" class="inputs" value="<?php echo $yazdir["cinsiyet"];?>">
    <option value="" disabled selected>Cinsiyeti</option>
    <option value="Erkek">Erkek</option>
    <option value="Kadın">Kadın</option>
</select>
</td>
</tr>
<tr>
<tr><td><b>Adres</b></td></tr>
<td>
<textarea name="adres" class="inputs"  rows="4" cols="50" value="<?php echo $yazdir["adres"];?>">

</textarea>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="tel" placeholder="Telefon" value="<?php echo $yazdir["tel"];?>" /></td>
</tr>
<tr>
<td>
<select name="cocuk" class="inputs" value="<?php echo $yazdir["cocuk"];?>">
    <option value="" disabled selected>Çocuk Sayısı</option>
    <option value="0">0</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    <option value="9">9</option>
    <option value="10">10</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="saglik" class="inputs" value="<?php echo $yazdir["saglik"];?>">
    <option value="" disabled selected>Sağlık Durumu</option>
    <option value="Yatan Hasta - Ağır">Yatan Hasta - Ağır</option>
    <option value="Yatan Hasta - Tedavisi Sürüyor">Yatan Hasta - Tedavisi Sürüyor</option>
    <option value="Taburcu">Taburcu</option>
</select>
</td>
</tr>
<tr>
<td><input id="myText" class="inputs" name="thastane" placeholder="Tedavi Gördüğü Hastane" value="<?php echo $yazdir["thastane"];?>" /></td>
</tr>
<tr>
<td><input id="myText1" class="inputs" name="khastane" placeholder="Kontrole Gittiği Hastane" value="<?php echo $yazdir["khastane"];?>" /></td>
</tr>
<tr>
<td>
<select class="inputs" value="<?php echo $yazdir["ibasvuru"];?>">
    <option value="" disabled selected>İstihdam Başvurusu</option>
    <option value="Kendisi">Kendisi</option>
    <option value="Eşi">Eşi</option>
    <option value="Kızı">Kızı</option>
    <option value="Oğlu">Oğlu</option>
    <option value="Annesi">Annesi</option>
    <option value="Babası">Babası</option>
</select>
</td>
</tr>
<tr>
<td>
<select class="inputs" value="<?php echo $yazdir["istihdam"];?>">
    <option value="" disabled selected>İstihdam Durumu</option>
    <option value="Atandı">Atandı</option>
    <option value="İşlem Devam Ediyor">İşlem Devam Ediyor</option>
    <option value="Daha Sonra Değerlendirecek">Daha Sonra Değerlendirecek</option>
</select>
</td>
</tr>
<tr>
<td>
<select name="ntazminatdurumu" class="inputs" value="<?php echo $yazdir["ntazminatdurumu"];?>" >
    <option value="" disabled selected>Nakdi Tazminat Durumu</option>
    <option value="Ödendi">Ödendi</option>
    <option value="İşlem Devam Ediyor">İşlem Devam Ediyor</option>
</select>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="ntazminat" placeholder="Nakdi Tazminat" value="<?php echo $yazdir["ntazminat"];?>" /></td>
</tr>
<tr>
<td><b>İl Müdürlüğünce Sunulan Hizmetler</b></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="sydv" placeholder="SYDV'den Yapılan Yardımlar" value="<?php echo $yazdir["sydv"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="belediye" placeholder="Belediyeden Yapılan Yardımlar" value="<?php echo $yazdir["belediye"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="sed" placeholder="3 Kat SED Yardımı" value="<?php echo $yazdir["sed"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="cocuk1" placeholder="1. Çocuk İçin Yapılan Yardım" value="<?php echo $yazdir["cocuk1"];?>" /></td>
</tr>
<tr>
<td><input type="text" class="inputs" name="cocuk2" placeholder="2. Çocuk İçin Yapılan Yardım" value="<?php echo $yazdir["cocuk2"];?>" /></td>
</tr>
<tr>
<td>
<select name="maddidurum" class="inputs" value="<?php echo $yazdir["maddidurum"];?>">
    <option value="" disabled selected>Maddi Durum</option>
    <option value="İhtiyaç Sahibidir">İhtiyaç Sahibidir</option>
    <option value="İhtiyacı Yoktur">İhtiyacı Yoktur</option>
</select>
</td>
</tr>
<tr>
<tr><td><b>Açıklama</b></td></tr>
<td>
<textarea name="aciklama"  class="inputs" rows="4" cols="50" value="<?php echo $yazdir["aciklama"];?>" >

</textarea>
</td>
</tr>
<tr>
<td><input type="text" class="inputs" name="personel" placeholder="Ziyareti Gerçekleştiren Personel" value="<?php echo $yazdir["personel"];?>" /></td>
</tr>
<tr>
<td><input name="id" type="hidden" value="<?php echo $id; ?>" /></td>
</tr>
<tr>
<td><input type="submit" name="gonder" value="Güncelle" /></td>
</tr>
</table>
</form>

这是我的更新页面

<?php
error_reporting(0);
include ("config.php");

$id = $_POST["id"];
$kurulus = $_POST["kurulus"];
$konu = $_POST["konu"];
$adsoyad = $_POST["adsoyad"];
$medeni = $_POST["medeni"];
$tc = $_POST["tc"];
$yas = $_POST["yas"];
$mensubiyet = $_POST["mensubiyet"];
$cinsiyet = $_POST["cinsiyet"];
$adres = $_POST["adres"];
$tel = $_POST["tel"];
$cocuk = $_POST["cocuk"];
$saglik = $_POST["saglik"];
$thastane = $_POST["thastane"];
$khastane = $_POST["khastane"];
$ibasvuru = $_POST["ibasvuru"];
$ibasvuru = $_POST["istihdam"];
$ntazminatdurumu = $_POST["ntazminatdurumu"];
$ntazminat = $_POST["ntazminat"];
$sydv = $_POST["sydv"];
$belediye = $_POST["belediye"];
$sed = $_POST["sed"];
$cocuk1 = $_POST["cocuk1"];
$cocuk2 = $_POST["cocuk2"];
$maddidurum = $_POST["maddidurum"];
$aciklama = $_POST["aciklama"];
$personel = $_POST["personel"];
$tarihsaat = $_POST["tarihsaat"];

$guncelle = mysql_query("update form set  kurulus='$kurulus', konu='$konu', adsoyad='$adsoyad', medeni='$medeni', tc='$tc', yas='$yas', mensubiyet='$mensubiyet', cinsiyet='$cinsiyet', adres='$adres', tel='$tel', cocuk='$cocuk', saglik='$saglik', thastane='$thastane', khastane='$khastane', ibasvuru='$ibasvuru', istihdam='$istihdam', ntazminatdurumu='$ntazminatdurumu', ntazminat='$ntazminat', sydv='$sydv', belediye='$belediye', sed='$sed', cocuk1='$cocuk1', cocuk2='$cocuk2', maddidurum='$maddidurum', aciklama='$aciklama', personel='$personel', tarihsaat='$tarihsaat' WHERE 'id=$id'");

if($guncelle){
    echo "başarılı";
    header("refresh:2; url=liste.php");
}else{
    echo "başarısız";
}
?>

我可以列出y数据,我可以看到带有数据的编辑页面,但我在哪里犯了更新错误。按下güncelle(更新)按钮后,没有任何变化!我很感激你发现我的错误。谢谢

1 个答案:

答案 0 :(得分:0)

WHERE'id = $ id'“

在id之前

删除' 它应该是WHERE id ='$ id'“