Ver Mensaje Individual
  #30 (permalink)  
Antiguo 17/10/2011, 12:39
kasumidie
 
Fecha de Ingreso: octubre-2011
Ubicación: CABA
Mensajes: 63
Antigüedad: 12 años, 6 meses
Puntos: 1
Si sos tan amable de decirme como puedo buscarlo, ya que busque y solo encontre para que me de 1 solo ID.

Cabe aclarar que si el ID de noticias es 5, el de Detalles es 4, Por ende el detalle_id de noticias es 4.

Código PHP:
Ver original
  1. <?php
  2.         $id=$_GET['id'];
  3.         $detalle_id=$_GET['id'];
  4.             $edita=$_GET['edita'];
  5.             $tipodepropiedad=$_GET['tipodepropiedad'];
  6.             $operacion=$_GET['operacion'];
  7.             $ambientes=$_GET['ambientes'];
  8.             $ubicacion=$_GET['ubicacion'];
  9.             $barrio=$_GET['barrio'];
  10.             $precio=$_GET['precio'];
  11.             $superficie=$_GET['superficie'];
  12.             $descripcion=$_GET['descripcion'];
  13.             $c1=$_GET['c1'];
  14.             $c2=$_GET['c2'];
  15.             $c3=$_GET['c3'];
  16.             $c4=$_GET['c4'];
  17.             $c5=$_GET['c5'];
  18.             $c6=$_GET['c6'];
  19.             $c7=$_GET['c7'];
  20.             $c8=$_GET['c8'];
  21.             $c9=$_GET['c9'];
  22.             $c10=$_GET['c10'];
  23.             $c11=$_GET['c11'];
  24.             $c12=$_GET['c12'];
  25.            
  26.        $link = mysql_connect("localhost", "x, "x");
  27.                         mysql_select_db("inmobiliaria");
  28.                                      
  29.        if (isset($id)){//Si existe id, siguiente paso...
  30.        
  31.                 if($edita!=""){//Si la variable edita 'existe'(por decirlo de alún modo) recojerá los datos enviados y los actualizará
  32.                    
  33.                      $sql2 = "UPDATE detalles SET tipodepropiedad='$tipodepropiedad', operacion='$operacion', ambientes='$ambientes', ubicacion='$ubicacion', barrio='$barrio', precio='$precio', superficie='$superficie', descripcion='$descripcion', c1='$c1', c2='$c2', c3='$c3', c4='$c4', c5='$c5', c6='$c6', c7='$c7', c8='$c8', c9='$c9', c10='$c10', c11='$c11', c12='$c12' WHERE id = '$detalle_id'";
  34.                         $result2 = mysql_query($sql2);
  35.                      
  36.                      $sql = "UPDATE noticias SET tipodepropiedad='$tipodepropiedad', operacion='$operacion', ambientes='$ambientes', ubicacion='$ubicacion', barrio='$barrio', precio='$precio', superficie='$superficie', descripcion='$descripcion' WHERE id = '$id'";
  37.                         $result = mysql_query($sql);
  38.                      
  39.                 }else{//Si la variable edita no esixte obtendrá los datos de id y los almacenará en sus respectivas variables para mostrarlos en el formulario
  40.                          $sql2 = "SELECT * FROM detalles WHERE id ='$detalle_id'";
  41.                         $result2 = mysql_query($sql2);
  42.                          $valores=mysql_fetch_array($result2);
  43.                          $tipodepropiedad=$valores['tipodepropiedad'];
  44.                         $operacion=$valores['operacion'];
  45.                          $ambientes=$valores['ambientes'];
  46.                         $ubicacion=$valores['ubicacion'];
  47.                          $barrio=$valores['barrio'];
  48.                          $precio=$valores['precio'];
  49.                         $superficie=$valores['superficie'];
  50.                         $descripcion=$valores['descripcion'];
  51.                          $c1=$valores['c1'];
  52.                         $c2=$valores['c2'];
  53.                          $c3=$valores['c3'];
  54.                         $c4=$valores['c4'];
  55.                          $c5=$valores['c5'];
  56.                         $c6=$valores['c6'];
  57.                          $c7=$valores['c7'];
  58.                          $c8=$valores['c8'];
  59.                          $c9=$valores['c9'];
  60.                          $c10=$valores['c10'];
  61.                          $c11=$valores['c11'];
  62.                          $c12=$valores['c12'];
  63.                         $edita="Editando...";
  64.                        
  65.                          $sql = "SELECT * FROM noticias WHERE id ='$id'";
  66.                         $result = mysql_query($sql);
  67.                         $valores=mysql_fetch_array($result);
  68.                          $tipodepropiedad=$valores['tipodepropiedad'];
  69.                         $operacion=$valores['operacion'];
  70.                          $ambientes=$valores['ambientes'];
  71.                         $ubicacion=$valores['ubicacion'];
  72.                          $barrio=$valores['barrio'];
  73.                          $precio=$valores['precio'];
  74.                         $superficie=$valores['superficie'];
  75.                         $descripcion=$valores['descripcion'];
  76.                         $edita="Editando...";
  77.                          
  78.                          
  79.                          
  80.                 }
  81.        }else{//Si no existe id, mostrará el formulario sin cambios...
  82.           echo "Formulario de inserción.\n";
  83.        }
  84.        ?>
  85.  
  86. <html>
  87. <head>
  88. <title>Panel de Control | Propiedades</title><link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
  89. </head>
  90. <center><body style="background: url('images/fondo.gif');">
  91. <div style="background:white; font-family:verdana; font-size:10px; width:960px; padding:15px;">
  92. <img src="images/banner.gif"><br></br>
  93. <div style="border-style:solid; border-width:1px; border-color:rgb(181,184,195);">
  94. <form enctype="multipart/form-data" id="panel" name="panel" method="get" action="modificar.php">
  95.     <h1 style="color:#ff6c00;">Panel de modificación</h1>
  96.    
  97.     <p><label><p>Id:</p><input type="text" name="id" size="50" maxlength="100" value="<? echo $id ?>" /></label></p>
  98.         <p><label><p>Id2:</p><input type="text" id="id" name="id" size="50" maxlength="100" value="<? echo $detalle_id ?>" /></label></p>
  99.  
  100. <p><label><p>Edita:</p><input type="text" name="edita" size="50" maxlength="100" value="<? echo $edita ?>" /></label></p>
  101.  
  102. <p><label><p>Tipo de propiedad:</p><input type="text" id="tipodepropiedad" name="tipodepropiedad" size="50" maxlength="100" value="<? echo $tipodepropiedad ?>" /></label></p>
  103.  
  104. <p><label><p>Operacion:</p><input type="text" id="operacion" name="operacion" size="50" maxlength="100" value="<? echo $operacion ?>" /></label></p>
  105.        
  106. <p><label><p>Ambientes:</p><input type="text" id="ambientes" name="ambientes" size="50" maxlength="100" value="<? echo $ambientes ?>" /></label></p>
  107.  
  108. <p><label><p>Dirección:</p><input type="text" id="ubicacion" name="ubicacion" size="50" maxlength="100" value="<? echo $ubicacion ?>" /></label></p>
  109.    
  110. <p><label><p>Barrio:</p><input type="text" id="barrio" name="barrio" size="50" maxlength="100" value="<? echo $barrio ?>" /></label></p>
  111.  
  112. <p><label><p>Precio:</p><input type="text" id="precio" name="precio" size="50" maxlength="100" value="<? echo $precio ?>" /></label></p>
  113.  
  114. <p><label><p>Superficie:</p><input type="text" id="superficie" name="superficie" size="50" maxlength="100" value="<? echo $superficie ?>" /></label></p>
  115.  
  116.    
  117. <p><label><h3 style="color:#ff6c00;">Descripción </h3>
  118. <input type="text" id="descripcion" name="descripcion" size="150" maxlength="1500" value="<? echo $descripcion ?>" /></label>
  119. <p>
  120. <br>
  121.     <h3 style="color:#ff6c00;">Caracteristicas del inmueble </h3>
  122.     <br>
  123.       <table width="635" border="0" cellspacing="0" cellpadding="0" style="font-family:verdana; font-size:10px;">
  124.       <tr>
  125.         <td width="327" align="left" valign="middle"><label>
  126.           <input type="text" id="c1" name="c1" size="40" maxlength="100" value="<? echo $c1 ?>" />
  127.           <br>
  128.           <br>
  129.         </label></td>
  130.         <td width="308" align="left" valign="middle"><label>
  131.           <input type="text" id="c2" name="c2" size="40" maxlength="100" value="<? echo $c2 ?>" />
  132.           <br>
  133.           <br>
  134.         </label></td>
  135.       </tr>
  136.       <tr>
  137.         <td align="left" valign="middle"><label>
  138.           <input type="text" id="c3" name="c3" size="40" maxlength="100" value="<? echo $c3 ?>" />
  139.           <br>
  140.           <br>
  141.         </label></td>
  142.         <td align="left" valign="middle"><label>
  143.           <input type="text" id="c4" name="c4" size="40" maxlength="100" value="<? echo $c4 ?>" />
  144.           <br>
  145.           <br>
  146.         </label></td>
  147.       </tr>
  148.       <tr>
  149.         <td align="left" valign="middle"><label>
  150.           <input type="text" id="c5" name="c5" size="40" maxlength="100" value="<? echo $c5 ?>" />
  151.           <br>
  152.           <br>
  153.         </label></td>
  154.         <td align="left" valign="middle"><label>
  155.           <input type="text" id="c6" name="c6" size="40" maxlength="100" value="<? echo $c6 ?>" />
  156.           <br>
  157.           <br>
  158.         </label></td>
  159.       </tr>
  160.       <tr>
  161.         <td align="left" valign="middle"><label>
  162.           <input type="text" id="c7" name="c7" size="40" maxlength="100" value="<? echo $c7 ?>" />
  163.           <br>
  164.           <br>
  165.         </label></td>
  166.         <td align="left" valign="middle"><label>
  167.           <input type="text" id="c8" name="c8" size="40" maxlength="100" value="<? echo $c8 ?>" />
  168.           <br>
  169.           <br>
  170.         </label></td>
  171.       </tr>
  172.       <tr>
  173.         <td align="left" valign="middle"><label>
  174.           <input type="text" id="c9" name="c9" size="40" maxlength="100" value="<? echo $c9 ?>" />
  175.           <br>
  176.           <br>
  177.         </label></td>
  178.         <td align="left" valign="middle"><label>
  179.           <input type="text" id="c10" name="c10" size="40" maxlength="100" value="<? echo $c10 ?>" />
  180.           <br>
  181.           <br>
  182.         </label></td>
  183.       </tr>
  184.       <tr>
  185.         <td align="left" valign="middle"><label>
  186.           <input type="text" id="c11" name="c11" size="40" maxlength="100" value="<? echo $c11 ?>" />
  187.           <br>
  188.           <br>
  189.         </label></td>
  190.         <td align="left" valign="middle"><label>
  191.           <input type="text" id="c12" name="c12" size="40" maxlength="100" value="<? echo $c12 ?>" />
  192.           <br>
  193.           <br>
  194.         </label></td>
  195.       </tr>
  196.     </table>
  197. <p><input type="submit" name="Publicar" value="Publicar"/>
  198.  
  199. </form>
  200. </div>
  201. <center>
  202. <p>© Copyright <a href=""> Propiedades</a> 2011. Todos los derechos reservados.
  203. </center>
  204. </div>
  205. </body></center>
  206. </html>

Última edición por GatorV; 17/10/2011 a las 20:41