Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/02/2014, 22:52
keivis
 
Fecha de Ingreso: julio-2013
Mensajes: 123
Antigüedad: 10 años, 9 meses
Puntos: 1
Respuesta: modificar registros de una db con mysql php

gracias por tu respuesta, si medite que al enviar a modificar los datos no me envia nada.

en primer instancia revise el código donde obtengo mi consulta y cambio los valores de los campos y mando a modificar. y no veo error.

Código PHP:
Ver original
  1. </head>
  2. <body>
  3. <br />
  4. <form id="registra" name="registra" method="post" action="actualiza.php">              
  5.          <?php
  6. include ("../conexion/conecta.php");
  7. $factura=$_POST['factura'];
  8. $con=mysql_connect ($host,$user,$pass) or die ("problemas con la conexion al server");
  9.   mysql_select_db ($db,$con) or die ("Error en la base de datos");
  10.     $result=mysql_query("SELECT * FROM facturar WHERE FACTURA='$_POST[factura]'", $con);  
  11.     if ($row = mysql_fetch_array($result)){
  12.  
  13.   ?>
  14.   <table  border="0" cellspacing="0" cellpadding="4" align="center">
  15.               <tr>
  16.            <td></td>
  17.               <td><p align="center"></p></td>
  18.               <td></td>
  19.               </tr><tr>
  20. <td></td><td>
  21. <table bordercolor="#D2D2D2" cellpadding="1" cellspacing="0" align=center border=1 width="100%">
  22.  <tr>  
  23.  <th colspan=4> Registro de Facturas </th>
  24. </tr>
  25. <tr>
  26.   <td colspan=2>Número de factura:</td>
  27.   <td colspan=2> <input type="text" name="factura" value="<?php echo $row["factura"]?>" /></td>
  28. <tr>
  29.   <td colspan=2>Lugar de Emisión:</td>
  30.   <td colspan=2><input type="text" name="emision"value="<?php echo $row["emision"]?>" /></td>
  31. </tr>
  32. <tr><td colspan="2">Fecha de Emisión: </td>
  33. <td><input type="text" size="20" name="fcha"value="<?php echo $row["fcha"]?>" /></td>
  34. </tr>
  35. <tr>
  36.   <td colspan=2>Nombre o Razón Social:</td>
  37.   <td colspan=2><input type="text" name="razon_social" value="<?php echo $row["razon_social"]?>" /></td>
  38. </tr>
  39. <tr>
  40.   <td colspan=2>Nº R.I.F/ C.I:</td>
  41.   <td colspan=2><input type="text" name="rif_ci" value="<?php echo $row["rif_ci"]?>" /></td>
  42. </tr>
  43. <tr>  
  44.  <th colspan=4> Registre datos descriptivos</th>
  45. </tr>
  46. <tr>
  47.   <td colspan=2>Cantidad horas Trabajadas: </td>
  48.   <td colspan=2><input type="text" name="horas_trabajadas" value="<?php echo $row["horas_trabajadas"]?>" /></td>
  49. </tr>
  50. <tr>
  51.   <td colspan=2>Concepto O Descripción:</td>
  52.   <td colspan=2> <textarea cols="19" rows="3" name="concepto"class="transforme2"><?php echo $row ["concepto"]?></textarea></td>
  53. </tr>
  54. <tr>
  55.   <td colspan=2>P./ Unit:</td>
  56.   <td colspan=2><input type="text" name="p_unit" value="<?php echo $row["p_unit"]?>" c/></td>
  57. </tr>
  58. <tr>
  59.   <td colspan=2>Total :</td>
  60.   <td colspan=2><input type="text" name="total" value="<?php echo $row["total"]?>" c/></td>
  61. </tr>
  62. <tr>
  63.   <td colspan=2>Periodo :</td>
  64.   <td colspan=2><input type="text" name="periodo" value="<?php echo $row["periodo"]?>" c/></td>
  65. </tr>
  66. <tr>
  67. <td colspan=2>Total Neto a Pagar :</td>
  68.   <td colspan=2><input type="text" name="total_pagar"value="<?php echo $row["total_pagar"]?>" class="transforme2" onFocus="this.className='transforme2'" onblur="this.className='transforme3'"/></td>
  69. </tr>
  70. </table></td>   </tr>            
  71.         </table>    
  72.   <table width="11%" height="6" border="0" align="center" bordercolor="#D2D2D2">
  73.   <tr><td><input type='hidden'  name='factura' value='$factura'>   <input type="submit"     size="10" onclick="return confirm('¿Deseas realmente modificar la factura&nbsp;<?php echo $row["factura"]?>?')"  value="Modificar"></a></td></tr>
  74.   </table>
  75.    <?php
  76.    
  77.      while ($row = mysql_fetch_array($result));          
  78. } else {  
  79. echo "¡ No se ha encontrado ningún registro !";  
  80. }  
  81. ?><
  82. </table>
  83. </form>
  84. </body>

aqui quiero cambiar tambien el campo factura.

Código SQL:
Ver original
  1. UPDATE facturar
  2. SET factura='$factura',
  3.      emision='$emision',
  4.      fcha='$fcha',
  5.      razon_social='$razon_social',
  6.      rif_ci='$rif_ci',
  7.      horas_trabajadas='$horas_trabajadas',
  8.      concepto='$concepto',
  9.      p_unit='$p_unit',
  10.      total='$total',
  11.      periodo='$periodo',
  12.      total_pagar='$total_pagar'
  13. WHERE factura='factura'