Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/11/2011, 15:10
privatefta
(Desactivado)
 
Fecha de Ingreso: septiembre-2010
Mensajes: 498
Antigüedad: 13 años, 7 meses
Puntos: 5
duda de como poder importar de una tabla a otra

Hola es que tengo este codigo ya hecho y estoy tratando de poder importar de una tabla a otra y al importa la cantidad eliminarla de donde estaba este es el codigo ya hecho.


transferir.class.php

Código PHP:
Ver original
  1. <?php
  2.     class transferir extends general
  3.     {
  4.         function __construct()
  5.         {
  6.             $db = new server();
  7.             $this->p = $_SESSION["posicion"];
  8.         }
  9.        /**
  10.         * Imprime un select
  11.         */
  12.         function creditos_renovaciones( $id,$m='' )
  13.         {
  14.            
  15.             echo "<select name='{$id}' id='{$id}'>";
  16.             echo "<option value='0'>Seleccione</option>";
  17.             for( $i = 1; $i <= $_SESSION["creditos_renovaciones"] ; $i++ )
  18.             {
  19.                 $s = $i == $m ? 'selected="selected"':'';
  20.                 echo "<option value='{$i}' {$s}>{$i}</option>";
  21.             }
  22.             echo "</select>";
  23.             if( $m > $_SESSION["creditos_renovaciones"] ) echo 'Cr&eacute;ditos actuales: '.$m;
  24.         }
  25.         function creditos_altas( $id,$m='' )
  26.         {
  27.            
  28.             echo "<select name='{$id}' id='{$id}'>";
  29.             echo "<option value='0'>Seleccione</option>";
  30.             for( $i = 1; $i <= $_SESSION["creditos_altas"] ; $i++ )
  31.             {
  32.                 $s = $i == $m ? 'selected="selected"':'';
  33.                 echo "<option value='{$i}' {$s}>{$i}</option>";
  34.             }
  35.             echo "</select>";
  36.             if( $m > $_SESSION["creditos_altas"] ) echo 'Cr&eacute;ditos actuales: '.$m;
  37.         }
  38.     }  
  39. ?>

transferir.php

Código PHP:
Ver original
  1. <?php
  2. $t = new transferir();
  3.     require_once("vista_transferir.php");
  4. ?>

vista_transferir.php

Código PHP:
Ver original
  1. <table width="600" align="center" border="2">
  2. <form name="transf" method="post" action=""></form>
  3.  
  4. <tbody><tr align="center"><th scope="col" colspan="2"><b>CREDITOS ACTUALES</b></th></tr>
  5. <tr>
  6. <td width="352">
  7. <?php echo $t->creditos_altas('');?>&nbsp;Altas de <font color="#FFCC66"><b><u><?php echo $_SESSION["creditos_altas"]?></u></b></font></td>
  8. <td width="230">&nbsp;Mover a
  9.  
  10. <input name="btnaccion" value="Renovaciones" type="submit">
  11. </td>
  12. </tr>
  13. <tr>
  14. <td>
  15. <?php echo $t->creditos_renovaciones('');?>&nbsp;Renovacion de <font color="#FFCC66"><b><u><?php echo $_SESSION["creditos_renovaciones"]?></u></b></font></td>
  16. <td>&nbsp;Mover a
  17. <input name="btnaccion" value="Altas" type="submit">
  18. </td>
  19. </tr>
  20. </tbody></table>

y esta es la sql

Código SQL:
Ver original
  1. CREATE TABLE IF NOT EXISTS `creditos` (
  2.   `id` INT(11) NOT NULL AUTO_INCREMENT,
  3.   `creditos_altas` INT(11) NOT NULL,
  4.   `creditos_renovaciones` INT(11) NOT NULL,
  5.   PRIMARY KEY (`id`),
  6. ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

aver como podria hacerlo