Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/11/2013, 05:59
Avatar de satjaen
satjaen
 
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
No me elimina las filas que selecciono de la lista.

Hola compañeros, por favor tengo una lista que no entiendo por qué cuando selecciono la fila que quiero eliminar no me la elimina y sin embrago me elimina la primera fila de la lista.



Código PHP:
Ver original
  1. $id_aviso=$_GET['id_aviso'];
  2. mysql_select_db($database_conexion, $conexion);
  3. $query_Recordset2 = "SELECT * FROM detalle_tiempo_factura WHERE id_aviso = '$id_aviso' ORDER BY ID_TIEMPO DESC ";
  4. $Recordset2 = mysql_query($query_Recordset2, $conexion) or die(mysql_error());
  5. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  6. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  7. $result2=mysql_query($query_Recordset2);
  8. $num=mysql_num_rows($result2);
  9.  
  10. if ((isset($_POST["ID_TIEMPO"])) && (isset($_POST["id_aviso"])) && ($_POST["MM_delete"] == "form7")) {
  11.        
  12.   $deleteSQL = sprintf("DELETE FROM detalle_tiempo_factura WHERE id_aviso='".$_POST['id_aviso']."' AND ID_TIEMPO='".$_POST['ID_TIEMPO']."'",
  13.  
  14.                        GetSQLValueString($_GET['id_aviso'], "int"),
  15.                        GetSQLValueString($_GET['ID_TIEMPO'], "int"));
  16.  
  17.   mysql_select_db($database_conexion, $conexion);
  18.   $Result1 = mysql_query($deleteSQL, $conexion) or die(mysql_error());
  19.      
  20.   }




Código Javascript:
Ver original
  1. <div id="tiac_factura" data-role="collapsible" data-collapsed="true" data-theme="e" data-content-theme="c" style="display:none">
  2.    
  3.    
  4.      
  5.                            <h3>(<?php echo $num ?>) Acumulado de tiempo FACTURA </h3>
  6.                                    
  7.                          
  8.                                     <br />
  9.                                    
  10.                                    
  11.                                    
  12.               <?php do { ?>
  13.  
  14.              
  15.                                       <ul data-role="listview" data-theme="b">                                    
  16.                            
  17.                
  18.                                        
  19.                                         <li data-theme="d">
  20.              
  21.               <form action="<?php echo $editFormAction; ?>" method="post" name="form7" id="form7">                      
  22.                                            
  23.  
  24.                                            
  25.                          <h2><?php echo $row_Recordset2['ID_TIEMPO']; ?></h2>
  26.                                            
  27.             <span style="font-size:15px"><strong>AVERÍA:&nbsp;</strong><?php echo $row_Recordset2['edAveria']; ?></span><br />  <hr />
  28.                                            
  29.                                          
  30.                                    
  31.  <fieldset class="ui-grid-a">    
  32.                
  33.                    <div class="ui-block-a" style="width:80%">
  34.                    
  35.  
  36.                      <input type="hidden" name="MM_delete" value="form7" />
  37.                   <input type="hidden" name="id_aviso" value="<?php echo $row_Recordset2['id_aviso']; ?>">
  38.                     <input type="hidden" name="ID_TIEMPO" value="<?php echo $row_Recordset2['ID_TIEMPO']; ?>">
  39.  
  40.  <button type="submit" onClick="return borrar()"  data-theme="e"  data-icon="delete" data-iconpos="center" data-ajax="false" >Eliminar</button>                
  41.            
  42.                
  43.                
  44.                   </form>
  45.                
  46.                     </div>
  47.                    
  48.                        </fieldset>  
  49.                                         </li>
  50.                                        
  51.                                
  52.                                       </ul>
  53.  
  54.                                     <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?>                          
  55.                              
  56.         <div style="text-align:right">
  57.                              
  58.                                 <hr />
  59.                                 Tiempo total: <strong><? echo $totcampo1 ?></strong> <!-- Mostramos el total -->  
  60.                                    
  61.                             </div>
  62.                              
  63.                                 </div>




js

Código Javascript:
Ver original
  1. <script>
  2.  
  3. function borrar(){
  4.  
  5.              
  6.                  
  7.                 if (confirm("¿Desea eliminarlo?"))
  8.                 {
  9.                    document.forms['form7'].submit();
  10.                    
  11.                 }
  12.                 else
  13.                 {
  14.                    return false;
  15.                 }
  16.        
  17. }
  18. </script>



Gracias