Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/09/2014, 12:37
robinson37
 
Fecha de Ingreso: marzo-2009
Mensajes: 44
Antigüedad: 15 años, 1 mes
Puntos: 1
Información Editar columna base datos

Hola como están

tengo un problema con la modificación de una columna en una tabla mysql
la verdad no soy muy experto

guardan todos menos la referencia quien me pueda ayudar mil gracias


este es el formulario

Código HTML:
Ver original
  1. <h3>
  2.    <form name="FormIngreso" action="../logica/LogicaActualizar.php" method="post" onSubmit="return validateForm()" enctype="multipart/form-data">
  3.    
  4.    <?php
  5. require_once("conexion.php");
  6. $sql="select * from codigos where referencia=".$_GET["referencia"]."";
  7. $res=mysql_query($sql,$con);
  8. ?>
  9.  
  10.  
  11.  
  12. <?php
  13. if ($reg=mysql_fetch_array($res))
  14. {
  15. ?>  
  16.     <table width="65%" border="0" align="center">
  17.      <tr>
  18.     <td width="22%">*Referencia:</td>
  19.     <td width="32%"><div align="left">
  20.       <label for="TB_Id"></label>
  21.       <input type="text" name="TB_Ref" id="TB_Ref" value="<?php echo $reg["referencia"];?>">
  22.     </div></td>
  23.    
  24.   </tr>
  25.   <tr>
  26.     <td>*Talla:</td>
  27.     <td><div align="left">
  28.       <input type="text" name="TB_Tall" id="TB_Tall" maxlength="5" value="<?php echo $reg["talla"];?>" >
  29.     </div></td>
  30.    
  31.   </tr>
  32.   <tr>
  33.     <td>*Marca:</td>
  34.     <td><div align="left">
  35.       <input type="text" name="TB_Mar" id="TB_Mar" value="<?php echo $reg["marca"];?>">
  36.     </div></td>
  37.    
  38.   </tr>
  39.   <tr>
  40.     <td>*Color:</td>
  41.     <td><div align="left">
  42.       <input type="text" name="TB_Col" id="TB_Col" maxlength="15" value="<?php echo $reg["color"];?>">
  43.     </div></td>
  44.  
  45.   </tr>
  46.   <tr>
  47.     <td>*Empaque:</td>
  48.     <td><div align="left">
  49.       <input type="text" name="TB_Emp" id="TB_Emp" value="empaque">
  50.     </div></td>
  51.    
  52.   </tr>
  53.   <tr>
  54.     <td>*Codigo barras</td>
  55.     <td><div align="left">
  56.       <input type="text" name="TB_Cdb" id="TB_Cdb" maxlength="13" onkeypress="return justNumbers(event);" value="<?php echo $reg["codigobarras"];?>">
  57.      
  58.       </select>
  59.     </div></td>
  60.    
  61.   </tr>
  62.   <tr>
  63.     <td>*Codigo color:</td>
  64.     <td><div align="left">
  65.      <input type="text" name="TB_Cdc" id="TB_Cdc" maxlength="3" value="<?php echo $reg["codcolor"];?>">
  66.     </div></td>
  67.   </tr>
  68.   <tr>
  69.    
  70.   </tr>
  71.   <tr>
  72.   <td width="8%">*Acrilico:</td>
  73.     <td width="38%"><div align="left">
  74.       <input type="text" name="TB_Acr" id="TB_Arc" maxlength="3" value="<?php echo $reg["acrilico"];?>">
  75.     </div></td>
  76. </tr>
  77.  
  78. <tr>
  79. <td>*Poliamida:</td>
  80.     <td><div align="left">
  81.       <input type="text" name="TB_Pol" id="TB_Pol" maxlength="3" value="<?php echo $reg["poliamida"];?>">
  82.     </div></td>
  83. </tr>
  84. <tr>
  85. <td>*Elastomero:</td>
  86.     <td><div align="left">
  87.       <input type="text" name="TB_Ela" id="TB_Ela" maxlength="3" value="<?php echo $reg["elastomero"];?>">
  88.     </div></td>
  89.    
  90. </tr>
  91. <tr>
  92. <td>*Algodon:</td>
  93.     <td><div align="left">
  94.       <input type="text" name="TB_Alg" id="TB_Alg" maxlength="3" value="<?php echo $reg["algodon"];?>">
  95.     </div></td>
  96. </tr>
  97. <tr>
  98. <td>*Poliester:</td>
  99.     <td><div align="left">
  100.       <input type="text" name="TB_Poli" id="TB_Poli" maxlength="3" value="<?php echo $reg["poliester"];?>">
  101.     </div></td>
  102. </tr>
  103. <tr>
  104. <td>*Caucho:</td>
  105.     <td><div align="left">
  106.       <input type="text" name="TB_Cau" id="TB_Cau" maxlength="3" value="<?php echo $reg["caucho"];?>">
  107.     </div></td>
  108. </tr>
  109.  
  110.   <tr>
  111.   <td>
  112.   </td>
  113.   </tr>
  114.   <tr>
  115.    
  116.     </tr>
  117.    
  118.     <td colspan="4" align="left"><div align="left">
  119.       <input type="submit" name="B_Actualizar" id="B_Actualizar" value="Actualizar Datos" >
  120.       </div><td>
  121.    </form>
  122.    
  123.    <td width="240" align="left">
  124.  
  125.      
  126.       </td>
  127.      
  128.      
  129.    </h3>
  130.    </section>
  131.    <table width="75" border="0">
  132.    <tr>
  133.    
  134.     <td width="51">
  135.     <div align="right"><input type="button" value="Modificar" onclick="activar()" /></div>
  136.     </td>
  137.     <td width="49%">
  138.     <div align="left"><input type="submit"  name="B_Borrar" id="B_Borrar" value="Eliminar" onClick="eliminar()"></div>
  139.     </td>
  140.     </tr>
  141.    </table>
  142.    <!--start holder-->
  143. <?php
  144. }
  145. ?>




Archivo LogicActualizar.php


Código PHP:
<?php
        
include('../Javascript/Mensajes.php');
        include(
'../Javascript/Control.php');
        include (
'conexion.php');
        
$TB_Ref     $_POST ['TB_Ref'];
        
$TB_Tall    $_POST ['TB_Tall'];
        
$TB_Mar     $_POST ['TB_Mar'];
        
$TB_Col     $_POST ['TB_Col'];
        
$TB_Emp     $_POST ['TB_Emp'];
        
$TB_Cdb     $_POST ['TB_Cdb'];
        
$TB_Cdc     $_POST ['TB_Cdc'];
        
$TB_Acr     $_POST ['TB_Acr'];
        
$TB_Pol     $_POST ['TB_Pol'];
        
$TB_Ela     $_POST ['TB_Ela'];
        
$TB_Alg     $_POST ['TB_Alg'];
        
$TB_Poli    $_POST ['TB_Poli'];
        
$TB_Cau     $_POST ['TB_Cau'];
        
        
$reg mysql_query ("UPDATE codigos SET referencia='$TB_Ref',talla='$TB_Tall',marca='$TB_Mar',color='$TB_Col',empaque='$TB_Emp',codigobarras='$TB_Cdb',codcolor='$TB_Cdc',acrilico='$TB_Acr',poliamida='$TB_Pol',elastomero='$TB_Ela',algodon='$TB_Alg',poliester='$TB_Poli',caucho='$TB_Cau' WHERE referencia='$TB_Ref'");
     
          if (
$reg){
              
            
Msg_Personalizado("Ha registrado Referencia satisfactoriamente");
            
header ("Location: ../Presentacion/ModifyRefe.php?referencia=".$_POST ['TB_Ref']);
            } else {
                 
               echo 
"Error de actualizacion "mysql_error (); 
            } 
            
    
?>