Birden fazla onay kutularını php veri güncelleme

0 Cevap php

i atı denilen bir tablo, ben horse_name ve horse_height düzenlemek için bir form oluşturmak istiyorum, ancak veriler güncellenmiş olamaz, bu güncelleştirme sorgusu ile bir sorun çıkıyor, i değerleri göstermek için sorgu yazdırırken, horse_name değer horse_height eşittir

<body bgcolor="#009933">
<?php
     include("connection.php"); 
     $conn = oci_connect($UName,$PWord,$DB);
     if(empty($_POST["check"]))
     {
    $query="SELECT * FROM horse ORDER BY horse_name";
    $stmt = oci_parse($conn, $query);
    oci_execute($stmt);


   ?>
<center> <font face="Arial" size="3"><b>Horse Details</b></font>
</center>

<form method="post" action="multiplehorsemodify.php">  
<table border="1" align="center">
  <tr>
  <th>Horse ID</th>
  <th>Name</th>
  <th>Height</th>
  <th>Edit?</th>

  </tr>


  <?php 
        while($row = oci_fetch_array ($stmt))
        {
  ?>
         <tr>
         <td><?php echo $row["HORSE_ID"]; ?></td>
         <td align="center">
         <input type="text" size="24" 
            name="<?php echo $row["HORSE_ID"]; ?>" 
            value="<?php echo $row["HORSE_NAME"]; ?>"></td>

         <td align="center">
         <input type="text" size="5" 
            name="<?php echo $row["HORSE_ID"]; ?>" 
            value="<?php echo $row["HORSE_HEIGHT"]; ?>"></td>
         <td align="center">

<input type="checkbox" name="check[]" value="<?php echo $row["HORSE_ID"]; ?>">

      </td>

         </tr>
  <?php 
        }
  ?>
  </table>
<center>
    <input type="submit" 
      value="Update Selected Titles" />
  </center>
</form>
<?php
    oci_free_statement($stmt);
     }
     else
     {
         foreach($_POST["check"] as $horse_id)  
         {
             echo $horse_id;
             $query = "UPDATE horse set horse_name = ".$_POST[$horse_id]."horse_height = ".$_POST[$horse_id]." WHERE horse_id = '".$horse_id."'";
             echo $query;
            $stmt = oci_parse($conn,$query);
            oci_execute($stmt);
            header("location: multiplehorsemodify.php");
         }
     }
     oci_close($conn);
?>

</body>

0 Cevap