Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/07/2007, 10:02
astut
 
Fecha de Ingreso: septiembre-2005
Ubicación: Valencia
Mensajes: 738
Antigüedad: 18 años, 7 meses
Puntos: 5
Re: Error en sentencia UPDATE

Solucionado, realmente no se que hice xD, bueno les dejo todo el codigo:
Código PHP:
<script language="javascript" >
    <!--Funcion que utilizaremos para mostrar el objeto seleccionado-->
    function MostrarObj(origen,destino)
    {
        document.getElementById(destino).src= document.getElementById(origen).value;
    }
</script>

<!--Seleccionar unidad para ser administrada-->
<div class="caja_contenedor">
  <div class="caja_seccion">Seleccionar unidad</div>
    <div class="caja_contenido">
      <?php include("../informador.php"); ?>
      <form id="formulario_principal" method="get" action="index.php">
          <fieldset id="fieldset_principal">
              <input type="hidden" id="pagina" name="pagina" value="ejercito_unidades"/>
        <label for="id" id="label_id" class="formulario">Unidad a administrar:</label>
                <select name="id" id="id" tabindex="1">
                    <optgroup label="<seleccionar>"></optgroup>
                  <?php
                        $leer
mysql_query("SELECT unidad1, unidad2, unidad3, unidad4 FROM villa_ejercito 
                                            WHERE id= '$_COOKIE[juego_jugador_id]'"
);
                        
$mostrarmysql_fetch_array($leer);
                    echo 
"<option value='1'>$mostrar[unidad1]</option>
                                    <option value='2'>$mostrar[unidad2]</option>
                                    <option value='3'>$mostrar[unidad3]</option>
                                    <option value='4'>$mostrar[unidad4]</option>"
;
                    
?>
                </select>
                <input type="submit" value="Administrar"/>
            </fieldset>
        </form>
    </div>
</div>

<!--Administrar unidad seleccionada-->
<?php
 
if (isset($_GET["id"]))
 {
      
//Leemos datos de la unidad para utilizarlos posteriormente y mostrarlos como defecto en el formulario
      
switch ($_GET["id"])
     {
       case 
"1":    $leer_unidadmysql_query("SELECT unidad1, unidad1_escudo, unidad1_yelmo, unidad1_armadura, unidad1_arma 
                                                                                      FROM villa_ejercito WHERE id= '$_COOKIE[juego_jugador_id]'"
); 
         break;
         case 
"2":    $leer_unidadmysql_query("SELECT unidad2, unidad2_escudo, unidad2_yelmo, unidad2_armadura, unidad2_arma
                                               FROM villa_ejercito WHERE id= '$_COOKIE[juego_jugador_id]'"
); 
         break;
         case 
"3":    $leer_unidadmysql_query("SELECT unidad3, unidad3_escudo, unidad3_yelmo, unidad3_armadura, unidad3_arma
                                               FROM villa_ejercito WHERE id= '$_COOKIE[juego_jugador_id]'"
); 
         break;
         case 
"4":    $leer_unidadmysql_query("SELECT unidad4, unidad4_escudo, unidad4_yelmo, unidad4_armadura, unidad4_arma
                                               FROM villa_ejercito WHERE id= '$_COOKIE[juego_jugador_id]'"
); 
         break;
     }
   
     
//Leemos objetos para mostrarlos en el formulario
     
$leer_inventario_escudosmysql_query("SELECT * FROM objeto WHERE metodologia= 'equipable' and tipo= 'escudo' ORDER BY id");
     
$leer_inventario_yelmosmysql_query("SELECT * FROM objeto WHERE metodologia= 'equipable' and tipo= 'yelmo' ORDER BY id");
     
$leer_inventario_armadurasmysql_query("SELECT * FROM objeto WHERE metodologia= 'equipable' and tipo= 'armadura' ORDER BY id");
     
$leer_inventario_armasmysql_query("SELECT * FROM objeto WHERE metodologia= 'equipable' and tipo= 'arma' ORDER BY id");
     
     
//Recogemos datos de la unidad para mostrarlos como defecto en el formulario
     
$unidad_datosmysql_fetch_row($leer_unidad);
     
     
//Leemos graficos de objetos equipados en la unidad para mostrar el grafico como defecto en el formulario
     
$leer_grafico_escudomysql_query("SELECT grafico FROM objeto WHERE id= '$unidad_datos[1]'");
     
$leer_grafico_yelmomysql_query("SELECT grafico FROM objeto WHERE id= '$unidad_datos[2]'");
     
$leer_grafico_armaduramysql_query("SELECT grafico FROM objeto WHERE id= '$unidad_datos[3]'");
     
$leer_grafico_armamysql_query("SELECT grafico FROM objeto WHERE id= '$unidad_datos[4]'");
     
     
//Recogemos grafico de los objetos ya equipados en la unidad para mostrarlos en el formulario
     
$unidad_grafico_escudomysql_fetch_row($leer_grafico_escudo); $unidad_grafico_yelmomysql_fetch_row($leer_grafico_yelmo);
     
$unidad_grafico_armaduramysql_fetch_row($leer_grafico_armadura); $unidad_grafico_armamysql_fetch_row($leer_grafico_arma);
     
     
     echo 
"<div class='caja_contenedor'>
                   <div class='caja_seccion'>Administrar equipo de la unidad</div>
               <div class='caja_contenido'>
                       <form id='formulario_principal' method='post' action='procesar/procesar_ejercito_unidades.php'>
                              <input type='hidden' name='id' id='id' value='$_GET[id]'/>
                             <div>
                                  <label for='nombre'>Nombre:</label>
                               <input type='text' name='nombre' id='nombre' tabindex='2' maxlength='16' value='$unidad_datos[0]'/>
                             </div>
                             
                           <div style='float: left; width: 25%;'>
                                <fieldset>
                                  <legend>Escudo</legend>
                                   <div style='margin: auto;'>"
;
                                          if (
$unidad_datos[1])
                                           echo 
"<img id='escudo' src='../../GRAFICOS/Juego/mapas/instancias/$unidad_grafico_escudo[0]' alt='' 
                                                   width='32px' height='32px'/>"
;
                                         else
                                           echo 
"<img id='escudo' src='../../GRAFICOS/Juego/mapas/instancias/0.gif' alt='' 
                                                   width='32px' height='32px'/>"
;
                         echo 
"</div>
                                     <div style='margin: auto'>"
?>
                     <select id='seleccionar_escudo' name='seleccionar_escudo' size='4' onchange="MostrarObj('seleccionar_escudo','escudo')" tabindex="3">
                                           <?php 
                                                 
while ($mostrarmysql_fetch_array($leer_inventario_escudos))
                                                {
                                                    if (
$mostrar["id"]= $unidad_datos[1])
                                                echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]' selected='selected'>
                                                          $mostrar[nombre]</option>"
;
                                                    else
                                                    echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]'>$mostrar[nombre]</option>";
                                                }
                             echo 
"</select>
                                 </div>
                               </fieldset>
                             </div>
                             
                             <div style='float: left; width: 25%;'>
                                <fieldset>
                                  <legend>Yelmo</legend>
                                   <div style='margin: auto;'>"
;
                                      if (
$unidad_datos[2])
                                           echo 
"<img id='yelmo' src='../../GRAFICOS/Juego/mapas/instancias/$unidad_grafico_yelmo[0]' alt='' 
                                                   width='32px' height='32px'/>"
;
                                         else
                                           echo 
"<img id='yelmo' src='../../GRAFICOS/Juego/mapas/instancias/0.gif' alt='' 
                                                   width='32px' height='32px'/>"
;
                         echo 
"</div>
                                     <div style='margin: auto'>"
?>
                     <select id='seleccionar_yelmo' name='seleccionar_yelmo' size='4' onchange="MostrarObj('seleccionar_yelmo','yelmo')" tabindex="4">
                                           <?php while ($mostrarmysql_fetch_array($leer_inventario_yelmos))
                                             {
                                                    if (
$mostrar["id"]= $unidad_datos[2])
                                                echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]' selected='selected'>
                                                          $mostrar[nombre]</option>"
;
                                                    else
                                                    echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]'>$mostrar[nombre]</option>";
                                                }
                             echo 
"</select>
                                 </div>
                               </fieldset>
                             </div>
                             
                             <div style='float: left; width: 25%;'>
                                <fieldset>
                                  <legend>Armadura</legend>
                                   <div style='margin: auto;'>"
;
                                        if (
$unidad_datos[3])
                                           echo 
"<img id='armadura' src='../../GRAFICOS/Juego/mapas/instancias/$unidad_grafico_armadura[0]' alt='' 
                                                   width='32px' height='32px'/>"
;
                                         else
                                           echo 
"<img id='armadura' src='../../GRAFICOS/Juego/mapas/instancias/0.gif' alt='' 
                                                   width='32px' height='32px'/>"
;
                         echo 
"</div>
                                     <div style='margin: auto'>"
?>
                     <select id='seleccionar_armadura' name='seleccionar_armadura' size='4' onchange="MostrarObj('seleccionar_armadura','armadura')" tabindex="5">
                                           <?php while ($mostrarmysql_fetch_array($leer_inventario_armaduras))
                                             {
                                                    if (
$mostrar["id"]= $unidad_datos[3])
                                                echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]' selected='selected'>
                                                          $mostrar[nombre]</option>"
;
                                                    else
                                                    echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]'>$mostrar[nombre]</option>";
                                                }
                             echo 
"</select>
                                 </div>
                               </fieldset>
                             </div>
                             
                             <div style='float: left; width: 25%;'>
                                <fieldset>
                                  <legend>Arma</legend>
                                   <div style='margin: auto;'>"
;
                                        if (
$unidad_datos[4])
                                           echo 
"<img id='arma' src='../../GRAFICOS/Juego/mapas/instancias/$unidad_grafico_arma[0]' alt='' 
                                                   width='32px' height='32px'/>"
;
                                         else
                                           echo 
"<img id='yelmo' src='../../GRAFICOS/Juego/mapas/instancias/0.gif' alt='' 
                                                   width='32px' height='32px'/>"
;
                         echo 
"</div>
                                     <div style='margin: auto'>"
?>
                     <select id='seleccionar_arma' name='seleccionar_arma' size='4' onchange="MostrarObj('seleccionar_arma','arma')" tabindex="6">
                                           <?php while ($mostrarmysql_fetch_array($leer_inventario_armas))
                                             {
                                                    if (
$mostrar["id"]= $unidad_datos[4])
                                                echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]' selected='selected'>
                                                          $mostrar[nombre]</option>"
;
                                                    else
                                                    echo 
"<option value='../../GRAFICOS/Juego/mapas/instancias/$mostrar[grafico]'>$mostrar[nombre]</option>";
                                                }
                             echo 
"</select>
                                 </div>
                               </fieldset>
                             </div>
                             <div style='clear: both;'></div><br/>
                             <input type='submit' value='Equipar'/>
                         </form>
                   </div>
                 </div>"
;
 }
?>