folder Tahribat.com Forumları
linefolder Asp - Php - Cgi - Perl
linefolder Php İle Table Güncelleme



Php İle Table Güncelleme

  1. KısayolKısayol reportŞikayet pmÖzel Mesaj
    AsayisciAsayisci
    Asayisci
    Asayisci's avatar
    Kayıt Tarihi: 14/Eylül/2009
    Erkek

    Asp.net da gridview güncelleme çok basit ancak bir projede ufak bir yerde php kullanmam gerekti.

    sayfa load olduğunda veritabanındaki satırları çekip satırları oluşturuyorum.

    fakat hemen bu tablonun tepesinde select nesnesi var. (combobox) seçilen seçime göre listeyi yeniden güncellemek istiyorum (filtrelemek).

    Yardımcı olabilecek var mı?

    <div class="d-flex">
      <div class="dropdown mr-1">
    <select> 
           <?php 
           $sorgu1 = mysqli_query($conn, "SELECT Customer_No FROM Servis GROUP BY Customer_No"); 
           while($row1 = mysqli_fetch_array($sorgu1)) 
           { 
                echo '<option value="'.$row1['Customer_No'].'">'.$row1['Customer_No'].'</option>'; 
           } 
           ?> 
      </select>
       </div>
        <div class="btn-group">
      <form action="" method="POST">
    <input type="submit" name="button1" value="Query" />
       </div>
    </div>
    <?php
    if(isset($_POST['button1'])){
    
    echo("click işlemi");
    }
    ?>
    <table class="table table-striped table-dark table-sm">
      <thead class="thead-dark">
        <tr>
          <th scope="col">#</th>
          <th scope="col">IP</th>
          <th scope="col">Licence</th>
          <th scope="col">Customer</th>
          <th scope="col">Serial</th>
          <th scope="col">Company</th>
          <th scope="col">Date</th>
          <th scope="col">Version</th>
        </tr>
      </thead>
      <tbody>
    <?php 
    
    $sql="SELECT * FROM Servis order by id desc";
    $sorgu=mysqli_query($conn, $sql);
    while( $sonuc=mysqli_fetch_row($sorgu) ){
        echo "<tr>";
        echo "<th scope='row'>$sonuc[0] </th>";  
        echo "<td>$sonuc[1]</td>";     
        echo "<td>$sonuc[2]</td>";  
        echo "<td>$sonuc[3]</td>";    
        echo "<td>$sonuc[4]</td>";
        echo "<td>$sonuc[5]</td>";
        echo "<td>$sonuc[6]</td>";
        echo "<td>$sonuc[7]</td>";
        echo "</tr>";
    }
    ?>
    Asayisci tarafından 02/Nis/20 17:11 tarihinde düzenlenmiştir
  2. KısayolKısayol reportŞikayet pmÖzel Mesaj
    coder2
    coder2's avatar
    Kayıt Tarihi: 15/Mart/2007
    Erkek

    Php ile bu tür işlemler için datatable kullanılıyor.   Php serverside datatable  diye arama yaparsanız kaynaklar çıkar hocam.


    Önceleri Kızlar Utanınca Kızarırdı Şimdilerde Kızarınca Utanıyorlar..
  3. KısayolKısayol reportŞikayet pmÖzel Mesaj
    wert
    wert's avatar
    Kayıt Tarihi: 19/Eylül/2005
    Erkek
    <div class="d-flex">
      <div class="dropdown mr-1">
    <select name="customer"> 
           <?php 
           $sorgu1 = mysqli_query($conn, "SELECT Customer_No FROM Servis GROUP BY Customer_No"); 
           while($row1 = mysqli_fetch_array($sorgu1)) 
           { 
                echo '<option value="'.$row1['Customer_No'].'">'.$row1['Customer_No'].'</option>'; 
           } 
           ?> 
      </select>
       </div>
        <div class="btn-group">
      <form action="" method="POST">
    <input type="submit" name="button1" value="Query" />
       </div>
    </div>
    
    <table class="table table-striped table-dark table-sm">
      <thead class="thead-dark">
        <tr>
          <th scope="col">#</th>
          <th scope="col">IP</th>
          <th scope="col">Licence</th>
          <th scope="col">Customer</th>
          <th scope="col">Serial</th>
          <th scope="col">Company</th>
          <th scope="col">Date</th>
          <th scope="col">Version</th>
        </tr>
      </thead>
      <tbody>
    <?php 
    
    if(isset($_POST['customer']) and (int)($_POST['customer'])>0){
    
        $sql="SELECT * FROM Servis where Customer_No=".(int)($_POST['customer'])." order by id desc";
    
    }else{
    
      $sql="SELECT * FROM Servis order by id desc";
    
    }
    
    $sorgu=mysqli_query($conn, $sql);
    while( $sonuc=mysqli_fetch_row($sorgu) ){
        echo "<tr>";
        echo "<th scope='row'>$sonuc[0] </th>";  
        echo "<td>$sonuc[1]</td>";     
        echo "<td>$sonuc[2]</td>";  
        echo "<td>$sonuc[3]</td>";    
        echo "<td>$sonuc[4]</td>";
        echo "<td>$sonuc[5]</td>";
        echo "<td>$sonuc[6]</td>";
        echo "<td>$sonuc[7]</td>";
        echo "</tr>";
    }
    ?>

    Böyle denermisin.

    ama şu aşağıdaki satırı böyle kullanmak yanlış

    $sql="SELECT * FROM Servis where Customer_No=".(int)($_POST['customer'])." order by id desc";

    aşağıdakini inceleyebilirsin

    https://www.w3schools.com/php/php_mysql_prepared_statements.asp

     


    |sadece aptalların başarısı ders notu ile ölçülür|
Toplam Hit: 1154 Toplam Mesaj: 3
php