• 29-03-2023, 11:32:28
    #1
    Merhaba aşağıdaki kodumda ilk sorgunun süsünü en sona koymuştum bu sefer tablom kaymıştı sadece 1 üye barındırıyor diğerlerini tablo dışına kayıt ediyordu
    süsü eski yerine yukarı koydum, modal için 1 sorgu daha oluşturdum ama hangi üyede düzenleye basarsam basayım hep aynı üyeyi açıyor

    <div class="table-responsive mt-3">
      <table class="table table-bordered" id="musteritablosu">
        <thead>
          <tr>
            <th>Kimlik</th>
            <th>Ad Soyad</th>
            <th>Plaka</th>
            <th>Telefon</th>
            <th>Yakın Telefon</th>
            <th>İkametgah</th>
            <th>Kan Grubu</th>
            <th>Tişört Beden</th>
            <th>Sweat Beden</th>
            <th>Doğum Tarihi</th>
            <th>Kayıt Tarihi</th>
            <th>Yetki Durumu</th>
            <th>Düzenle</th>
          </tr>
        </thead>
        <tbody>
          <?php 
          $sayi=0;
          $sorgu=$db->prepare("SELECT * FROM Uyeler");
          $sorgu->execute();
          while ($UyeBilgisi=$sorgu->fetch(PDO::FETCH_ASSOC)) { 
            $sayi++;
            ?>
            <tr>
              <td><?php echo $sayi; ?></td>
              <td><?php echo $UyeBilgisi['Uye_AdSoyad']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_Plaka']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_Telefon']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_YTelefon']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_Ikametgah']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_KanGrubu']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_TisortBeden']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_SweatBeden']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_DogumTarihi']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_KayitTarihi']; ?></td>
              <td><?php echo $UyeBilgisi['Uye_Yetki']; ?></td>
              <td>
                <div class="row justify-content-center">
                    <input type="hidden" name="Uye_Kimlik" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>">
                    <button type="submit" data-toggle="modal" data-target="#UyeDuzenle" class="btn btn-success btn-sm btn-icon-split">
                      <span class="icon text-white-60">
                        <i class="fas fa-edit"></i>
                      </span>
                    </button>
                  <form class="mx-1" action="islemler/ajax.php" method="POST" accept-charset="utf-8">
                    <input type="hidden" name="Uye_Kimlik" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>">
                    <button type="submit" name="musterisilme" class="btn btn-danger btn-sm btn-icon-split">
                      <span class="icon text-white-60">
                        <i class="fas fa-trash"></i>
                      </span>
                    </button>
                  </form>
                  <form action="musteri.php" method="POST" accept-charset="utf-8">
                    <input type="hidden" name="Uye_Kimlik" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>">
                    <button type="submit" name="duzenleme" class="btn btn-primary btn-sm btn-icon-split">
                      <span class="icon text-white-60">
                        <i class="fas fa-eye"></i>
                      </span>
                    </button>
                  </form>
                </div>
              </td>
            </tr>
            <?php } ?> 
            </tbody>
      </table>
    </div>
    </div>
    </div>
    <!--Datatables çıkış-->
    </div>
    <?php
    $sorgu=$db->prepare("SELECT * FROM Uyeler");
    $sorgu->execute();
    while ($UyeBilgisi=$sorgu->fetch(PDO::FETCH_ASSOC)) { 
    ?>
    <div class="modal fade" id="UyeDuzenle" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title" id="exampleModalLabel">Üye Güncelle</h5>
              <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">×</span>
              </button>
            </div>
                   <form class="mx-1" action="islemler/ajax.php" method="POST" accept-charset="utf-8">
                    <div class="card-body">
                    <div class="form-group">
                    <label>Ad Soyad</label>
                      <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <span class="input-group-text"><i class="fas fa-user"></i></span>
                      </div>
                      <input type="hidden" name="Uye_Kimlik" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>">
                      <input type="text" name="Uye_AdSoyad" class="form-control" placeholder="Ad Soyad" value="<?php echo $UyeBilgisi['Uye_AdSoyad']; ?>">
                    </div>
                  </div>
                  <div class="form-group">
                      <label>Plaka</label>
                      <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <span class="input-group-text"><i class="fas fa-car"></i></span>
                      </div>
                      <input type="text" name="Uye_Plaka" class="form-control" placeholder="Plaka" value="<?php echo $UyeBilgisi['Uye_Plaka']; ?>">
                    </div>
                  </div>
                  
                  <div class="row">
                  <div class="col-sm-6">
                  <div class="form-group">
                      <label for="exampleInputEmail1">Telefon</label>
                      <div class="input-group mb-3">
                      <div class="input-group-prepend">
                        <span class="input-group-text"><i class="fas fa-phone"></i></span>
                      </div>
                      <input type="text" name="Uye_Telefon" class="form-control" placeholder="Telefon" value="<?php echo $UyeBilgisi['Uye_Telefon']; ?>">
                    </div>
                  </div>
                  </div>
                  
                  <div class="col-sm-6">
                  <div class="form-group">
                      <label>Yakın Telefon</label>
                      <div class="input-group">
                        <div class="input-group-prepend">
                          <span class="input-group-text"><i class="fas fa-phone"></i></span>
                        </div>
                        <input type="text" name="Uye_YTelefon" class="form-control" placeholder="Yakın Telefon" value="<?php echo $UyeBilgisi['Uye_YTelefon']; ?>">
                      </div>
                      <!-- /.input group -->
                    </div>
                    </div>
                    
                    <div class="col-sm-6">
                    <div class="form-group">
                      <label>Doğum Tarihi</label>
                      <div class="input-group">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="far fa-calendar-alt"></i>
                          </span>
                        </div>
                        <input type="text" name="Uye_DogumTarihi" class="form-control float-right"  value="<?php echo $UyeBilgisi['Uye_DogumTarihi']; ?>">
                      </div>
                      <!-- /.input group -->
                    </div>
                    </div>
                    <div class="col-sm-6">
                    <div class="form-group">
                      <label>Kayıt Tarihi</label>
                      <div class="input-group">
                        <div class="input-group-prepend">
                          <span class="input-group-text">
                            <i class="far fa-calendar-alt"></i>
                          </span>
                        </div>
                        <input type="text" name="Uye_KayitTarihi" class="form-control float-right" placeholder="01.01.2023" value="<?php echo $UyeBilgisi['Uye_KayitTarihi']; ?>" disabled>
                      </div>
                      <!-- /.input group -->
                    </div>
                    </div>                
    
                    <!-- select -->
                    <div class="col-sm-6">
                    <div class="form-group">
                    <label>İkametgah</label>
                    <select class="form-control" name="Uye_Ikametgah">
                      <?php 
                        $ikametgahlar = array("Merkez", "Çerkezköy", "Çorlu", "Kapaklı", "KızılPınar", "Karaağaç", "Ergene", "Hayrabolu", "Muratlı", "Saray", "Süleymanpaşa", "Şarköy");
                        foreach ($ikametgahlar as $Uye_Ikametgah) {
                          if ($UyeBilgisi['Uye_Ikametgah'] != $Uye_Ikametgah) {
                            echo '<option value="' . $Uye_Ikametgah . '">' . $Uye_Ikametgah . '</option>';
                          } else {
                            echo '<option value="' . $Uye_Ikametgah . '" selected>' . $Uye_Ikametgah . '</option>';
                          }
                        }
                      ?>
                    </select>
                  </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                    <label>Kan Grubu</label>
                    <select class="form-control" name="Uye_KanGrubu">
                      <?php 
                        $KanGruplari = array("0 ( Rh ) +", "0 ( Rh ) -", "A ( Rh ) +", "A ( Rh ) +", "B ( Rh ) +", "B ( Rh ) -", "AB ( Rh ) +", "AB ( Rh ) -");
                        foreach ($KanGruplari as $Uye_KanGrubu) {
                          if ($UyeBilgisi['Uye_KanGrubu'] != $Uye_KanGrubu) {
                            echo '<option value="' . $Uye_KanGrubu . '">' . $Uye_KanGrubu . '</option>';
                          } else {
                            echo '<option value="' . $Uye_KanGrubu . '" selected>' . $Uye_KanGrubu . '</option>';
                          }
                        }
                      ?>
                    </select>
                  </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                    <label>Tişört Bedeni</label>
                    <select class="form-control" name="Uye_TisortBeden">
                      <?php 
                        $Bedenler = array("XS", "S", "M", "L", "XL", "XXL", "3XL", "4XL");
                        foreach ($Bedenler as $Uye_TisortBeden) {
                          if ($UyeBilgisi['Uye_TisortBeden'] != $Uye_TisortBeden) {
                            echo '<option value="' . $Uye_TisortBeden . '">' . $Uye_TisortBeden . '</option>';
                          } else {
                            echo '<option value="' . $Uye_TisortBeden . '" selected>' . $Uye_TisortBeden . '</option>';
                          }
                        }
                      ?>
                    </select>
                  </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                    <label>Sweat Bedeni</label>
                    <select class="form-control" name="Uye_SweatBeden">
                      <?php 
                        $Bedenler = array("XS", "S", "M", "L", "XL", "XXL", "3XL", "4XL");
                        foreach ($Bedenler as $Uye_SweatBeden) {
                          if ($UyeBilgisi['Uye_SweatBeden'] != $Uye_SweatBeden) {
                            echo '<option value="' . $Uye_SweatBeden . '">' . $Uye_SweatBeden . '</option>';
                          } else {
                            echo '<option value="' . $Uye_SweatBeden . '" selected>' . $Uye_SweatBeden . '</option>';
                          }
                        }
                      ?>
                    </select>
                  </div>
                  </div>
                  <div class="col-sm-6">
                    <div class="form-group">
                    <label>Yetki Durumu</label>
                    <select class="form-control" name="Uye_Yetki">
                      <?php 
                        $Durum = array("Üye", "Admin", "Medya", "Asker", "Araç Yok.");
                        foreach ($Durum as $Uye_Yetki) {
                          if ($UyeBilgisi['Uye_Yetki'] != $Uye_Yetki) {
                            echo '<option value="' . $Uye_Yetki . '">' . $Uye_Yetki . '</option>';
                          } else {
                            echo '<option value="' . $Uye_Yetki . '" selected>' . $Uye_Yetki . '</option>';
                          }
                        }
                      ?>
                    </select>
                  </div>
                  </div>
                  
                
                </div>
                </div>
                <form>
                <div class="modal-footer justify-content-between">
                  <button type="button" class="btn btn-danger" data-dismiss="modal">Kapat</button>
                  <form class="mx-1" action="islemler/ajax.php" method="POST" accept-charset="utf-8">
                    <input type="hidden" name="Uye_Kimlik" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>">
                    <button type="submit" name="UyeDuzenleme" class="btn btn-success">Güncelle</button>
                </div>
              </div>
              <!-- /.modal-content -->
            </div>
            <!-- /.modal-dialog -->
          </div>
          <!-- /.modal -->
          <?php } ?>
  • 29-03-2023, 11:56:13
    #2
    + güncel yardımlarınızı bekliyorum üye güncellemede tıkandım aynı üye verileri geliyor
  • 29-03-2023, 12:17:17
    #3
    $sorgu=$db->prepare("SELECT * FROM Uyeler"); bu yanlış.
    $sorgu=$db->prepare("SELECT * FROM Uyeler where uye_id=$id"); şeklinde olmalı.
    get ile üye id çağrılmalı
  • 29-03-2023, 13:04:11
    #4
    ntka adlı üyeden alıntı: mesajı görüntüle
    $sorgu=$db->prepare("SELECT * FROM Uyeler"); bu yanlış.
    $sorgu=$db->prepare("SELECT * FROM Uyeler where uye_id=$id"); şeklinde olmalı.
    get ile üye id çağrılmalı

    Sorunu çözdüm

            <button type="submit" data-toggle="modal" value="<?php echo $UyeBilgisi['Uye_Kimlik']?>" data-target="#UyeDuzenle<?php echo $UyeBilgisi['Uye_Kimlik']?>" class="btn btn-success btn-sm btn-icon-split">
                      <span class="icon text-white-60">
                        <i class="fas fa-edit"></i>
                      </span>
                    </button>
    <?php
    $sorgu=$db->prepare("SELECT * FROM Uyeler");
    $sorgu->execute();
    while ($UyeBilgisi=$sorgu->fetch(PDO::FETCH_ASSOC)) { 
    ?>
    <div class="modal fade" id="UyeDuzenle<?php echo $UyeBilgisi['Uye_Kimlik']?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <h5 class="modal-title" id="exampleModalLabel">Üye Güncelle</h5>
              <button class="close" type="button" data-dismiss="modal" aria-label="Close">
                <span aria-hidden="true">×</span>
              </button>
            </div>