我有一个问题,我试图使用codeigniter从列更新字段,我使用foreach循环显示数据库的结果然后我想添加一个名为“重新激活”的按钮来更改该列的状态,问题是那个它会更新我想要更新我点击的行的所有字段,但它会更改所有其他帐户的“状态”,我不知道如何解决此问题 . 提前致谢 . 这是我的看法:

div class='container'>
      <h5>Histórico</h5>
    <table id='table' class='table'>
     <thead>
      <tr>       
        <th>INTERNO</th>
        <th>CLABE</th>
        <th>FECHA_ALTA</th>
        <th>FECHA_BAJA</th>
        <th>STATUS</th>
        <th>ACCIÓN</th>
     </thead>
      <tbody>
<?php
        foreach ($mos-> result() as $row) {
          echo "<tr>";
                echo "<td>".$row->Interno;"</td>";
                echo "<td>".$row->Clabe;"</td>";
                  echo "<td>".$row->Fecha_alta;"</td>";
                  echo "<td>".$row->Fecha_baja;"</td>";
                  echo "<td>".$row->Status;"</td>"; 
                echo "<td><input type='submit' id='ReActivar' name='ReActivar' class='btn btn-success' value='ReActivar' onclick='return validacion();' disabled><span id='msg'></span></td>";
         "</tr>";  
         }
      ?>    
  </tbody>
</table>
</div>

这是我的控制器:

function decision(){
      if (!empty($_POST['actualizar'])) {
     $this->validaclabe();
      }

    if (!empty($_POST['Desactivar'])) {
   $this->update_Status();
}

if (!empty($_POST['ReActivar'])) {
   $this->update_Status_again();
}
}

function update_Status_again() 
{
     $this->load->helper('date'); 
      date_default_timezone_set('America/Mexico_City'); 
      $now = date('Y-m-d H:i:s');    
    $Interno = $this->input->post('Interno');
    $Status = $this->input->post('activo');

     $data = array(
     'Status' =>  ! empty($Status) ? $Status : 'A',
    'Fecha_alta' => $now,
  );

    //$data['status'] = ! empty($Status) ? $Status : 'I';
    if ( ! empty($Interno))
    {
        $updated = $this->consultas_M->update_Status($Interno, $data);
        if($updated)
        {
           //echo " update successful...";
           $this->logueado();
           //redirect('index.php/Datos/search2');
        }
        else
        { echo "update not successful...";}  
    } else
    { echo "Interno  not found ..."; }    
}

这是模型:

function muestra_inactivos($Interno)
     {  $Status = 'A';
        //$Interno = $this->input->get('Interno');
        $this->db->select('Interno, Clabe, Fecha_alta, Fecha_baja, Status');
        $this->db->where('Status !=', $Status);
        $this->db->where('Interno =', $Interno);
    $q= $this->db ->get('cuentas');
  if($q -> num_rows() >= 0){
    return $q;
  }else{
    return false;
  }
  }

 function update_Status_again($Interno,$data)
{
   $this->db->where('Interno', $Interno);
   return $this->db->update('cuentas', $data);
   if ( $this->db->affected_rows() > 0 )
   {
      return TRUE;
   }
   else 
   {
     return FALSE;
   }

}

这也是一张图片我也不知道为什么一个按钮被禁用而另一个按钮没有被禁用 .
webpage