Foros del Web » Programación para mayores de 30 ;) » Bases de Datos General » Mysql »

error de linea no se como quitarlo

Estas en el tema de error de linea no se como quitarlo en el foro de Mysql en Foros del Web. Hola amigos resulta que tengo el sig formulario para actualizar pero me sale el error: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given ...
  #1 (permalink)  
Antiguo 28/05/2013, 15:41
 
Fecha de Ingreso: mayo-2013
Mensajes: 4
Antigüedad: 10 años, 10 meses
Puntos: 0
error de linea no se como quitarlo

Hola amigos resulta que tengo el sig formulario para actualizar pero me sale el error:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\inmobiliaria\formulario2.php on line 16

y apesar de que la bd aparecen bn los parametros de las columnas me aparece este error

Notice: Undefined index: in_id in C:\xampp\htdocs\inmobiliaria\formulario2.php on line 14

estees el codigo
Código PHP:
Ver original
  1. <?php  
  2. $BD=mysql_connect("localhost", "root", "");
  3. mysql_select_db("inmobiliaria", $BD);
  4. $sentencia="SELECT * FROM inmuebles WHERE in_id=".$_GET['in_id'];
  5. $consulta=mysql_query($sentencia);
  6. $fila = mysql_fetch_array($consulta);
  7. ?>
  8. <form action="actualizado.php" method="post">
  9. <table width="80%"  align="center" bordercolor="#0000FF">
  10.   <tr>
  11.     <td class="textoinfo">Tipo de Inmueble</td>
  12.     <td><select name="mitipo">
  13.     <option value="casa"<?php if($fila['in_tipo']=='casa'){echo ' selected="selected"';} ?>>Casa</option>
  14.     <option value="apartamento"<?php if($fila['in_tipo']=='apartamento'){echo ' selected="selected"';} ?>>Apartamento</option>
  15.     <option value="apartaestudio"<?php if($fila['in_tipo']=='apartaestudio'){echo ' selected="selected"';} ?>>Apartaestudio</option>
  16.     <option value="duplex"<?php if($fila['in_tipo']=='duplex'){echo ' selected="selected"';} ?>>Duplex</option>
  17.     <option value="triplex"<?php if($fila['in_tipo']=='triplex'){echo ' selected="selected"';} ?>>Triplex</option>
  18.     <option value="local"<?php if($fila['in_tipo']=='local'){echo ' selected="selected"';} ?>>Local</option>
  19.     </select>
  20.    
  21.     </td>
  22.   </tr>
  23.   <tr>
  24.     <td class="textoinfo">Tipo de Negocio</td>
  25.     <td><select name="minegocio">
  26.     <option value="venta"<?php if($fila['in_negocio']=='venta'){echo ' selected="selected"';} ?>>Venta</option>
  27.     <option value="arriendo"<?php if($fila['in_negocio']=='arriendo'){echo ' selected="selected"';} ?>>Arriendo</option>
  28.     <option value="permuta"<?php if($fila['in_negocio']=='permuta'){echo ' selected="selected"';} ?>>Permuta</option>
  29.     </select>
  30.     </td>
  31.   </tr>
  32.   <tr>
  33.     <td class="textoinfo">Ubicación</td>
  34.     <td>
  35.     <select name="miubicacion">
  36.     <option value="ANTONIO NARIÑO"<?php if($fila['in_ubicacion']=='antonio nariño'){echo ' selected="selected"';} ?>>ANTONIO NARIÑO</option>
  37.     <option value="BARRIOS UNIDOS"<?php if($fila['in_ubicacion']=='barrios unidos'){echo ' selected="selected"';} ?>>BARRIOS UNIDOS</option>
  38.     <option value="BOSA"<?php if($fila['in_ubicacion']=='bosa'){echo ' selected="selected"';} ?>>BOSA</option>
  39.     <option value="CHAPINERO"<?php if($fila['in_ubicacion']=='chapinero'){echo ' selected="selected"';} ?>>CHAPINERO</option>
  40.     <option value="CIUDAD BOLÍVAR"<?php if($fila['in_ubicacion']=='ciudad bolivar'){echo ' selected="selected"';} ?>>CIUDAD BOLÍVAR</option>
  41.     <option value="ENGATIVÁ"<?php if($fila['in_ubicacion']=='engativa'){echo ' selected="selected"';} ?>>ENGATIVÁ</option>
  42.     <option value="FONTIBÓN"<?php if($fila['in_ubicacion']=='fontibon'){echo ' selected="selected"';} ?>>FONTIBÓN</option>
  43.     <option value="KENNEDY"<?php if($fila['in_ubicacion']=='kennedy'){echo ' selected="selected"';} ?>>KENNEDY</option>
  44.     <option value="CANDELARIA"<?php if($fila['in_ubicacion']=='candelaria'){echo ' selected="selected"';} ?>>LA CANDELARIA</option>
  45.     <option value="LOS MÁRTIRES"<?php if($fila['in_ubicacion']=='los martires'){echo ' selected="selected"';} ?>>LOS MÁRTIRES</option>
  46.     <option value="PUENTE ARANDA"<?php if($fila['in_ubicacion']=='puente aranda'){echo ' selected="selected"';} ?>>PUENTE ARANDA</option>
  47.     <option value="RAFAEL URIBE"<?php if($fila['in_ubicacion']=='rafael uribe'){echo ' selected="selected"';} ?>>RAFAEL URIBE</option>
  48.     <option value="SAN CRISTOBAL"<?php if($fila['in_ubicacion']=='san cristobal'){echo ' selected="selected"';} ?>>SAN CRISTOBAL</option>
  49.     <option value="SANTA FE"<?php if($fila['in_ubicacion']=='santa fe'){echo ' selected="selected"';} ?>>SANTA FE</option>
  50.     <option value="SUBA"<?php if($fila['in_ubicacion']=='suba'){echo ' selected="selected"';} ?>>SUBA</option>
  51.     <option value="SUMAPAZ"<?php if($fila['in_ubicacion']=='sumapaz'){echo ' selected="selected"';} ?>>SUMAPAZ</option>
  52.     <option value="TEUSAQUILLO"<?php if($fila['in_ubicacion']=='teusaquillo'){echo ' selected="selected"';} ?>>TEUSAQUILLO</option>
  53.     <option value="TUNJUELITO"<?php if($fila['in_ubicacion']=='tunjuelito'){echo ' selected="selected"';} ?>>TUNJUELITO</option>
  54.     <option value="USAQUÉN"<?php if($fila['in_ubicacion']=='usaquen'){echo ' selected="selected"';} ?>>USAQUÉN</option>
  55.     <option value="USME"<?php if($fila['in_ubicacion']=='usme'){echo ' selected="selected"';} ?>>USME</option>
  56.    
  57.     </select>  
  58.     </td>
  59.     <tr>
  60.     <td class="textoinfo">
  61.     Precio
  62.     </td>
  63.     <TD>
  64.     <input type="text" name="miprecio" value="<?php echo $fila['in_precio']; ?>" />  
  65.     </TD>
  66.     </tr>
  67.   </tr>
  68.   <tr>
  69.     <td class="textoinfo">Area (en metros cuadrados)</td>
  70.     <td>
  71.     <input type="text" name="miarea" value="<?php echo $fila['in_area']; ?>" />
  72.     </td>
  73.   </tr>
  74.   <tr>
  75.     <td class="textoinfo">Número de Baños</td>
  76.     <td>
  77.     <select name="mibano">
  78.     <option value="uno"<?php if($fila['in_banos']=='uno'){echo ' selected="selected"';} ?>>1</option>
  79.     <option value="dos"<?php if($fila['in_banos']=='dos'){echo ' selected="selected"';} ?>>2</option>
  80.     <option value="tres"<?php if($fila['in_banos']=='tres'){echo ' selected="selected"';} ?>>3</option>
  81.     <option value="cuatro"<?php if($fila['in_banos']=='cuatro'){echo ' selected="selected"';} ?>>4</option>
  82.     <option value="mas"<?php if($fila['in_banos']=='mas'){echo ' selected="selected"';} ?>>5 o más</option>
  83.     </select>
  84.     </td>
  85.   </tr>
  86.   <tr>
  87.     <td class="textoinfo">
  88.     Número de Habitaciones
  89.     </td>
  90.     <td>
  91.     <select name="mihabitacion">
  92.     <option value="cero"<?php if($fila['in_habitaciones']=='cero'){echo ' selected="selected"';} ?>>Sin habitación</option>
  93.     <option value="uno"<?php if($fila['in_habitaciones']=='uno'){echo ' selected="selected"';} ?>>1</option>
  94.     <option value="dos"<?php if($fila['in_habitaciones']=='dos'){echo ' selected="selected"';} ?>>2</option>
  95.     <option value="tres"<?php if($fila['in_habitaciones']=='tres'){echo ' selected="selected"';} ?>>3</option>
  96.     <option value="cuatro"<?php if($fila['in_habitaciones']=='cuatro'){echo ' selected="selected"';} ?>>4</option>
  97.     <option value="mas"<?php if($fila['in_habitaciones']=='mas'){echo ' selected="selected"';} ?>>5 o más</option>
  98.     </select>
  99.     </td>
  100.   </tr>
  101.   <tr>
  102.     <td class="textoinfo">Parqueadero</td>
  103.     <td>
  104.     <select name="miparqueadero">
  105.     <option value="si"<?php if($fila['in_parqueadero']=='si'){echo ' selected="selected"';} ?>>Si</option>
  106.     <option value="no"<?php if($fila['in_parqueadero']=='no'){echo ' selected="selected"';} ?>>No</option>
  107.     </select></td>
  108.   </tr>
  109.   <tr>
  110.     <td class="textoinfo">
  111.     Nombre del propietario
  112.     </td>
  113.     <td>
  114.     <input type="text" name="mipropietario" value="<?php echo $fila['in_propietario']; ?>" />
  115.     </td>
  116.   </tr>
  117.   <tr>
  118.     <td class="textoinfo">
  119.     Teléfono Fijo del propietario
  120.     </td>
  121.     <td><input type="text" name="mifijo" value="<?php echo $fila['in_fijo']; ?>" /></td>
  122.   </tr>
  123.   <tr>
  124.     <td class="textoinfo">Teléfono Celular del Propietario</td>
  125.     <td><input type="text" name="micelular" value="<?php echo $fila['in_celular']; ?>" /></td>
  126.   </tr>
  127.   <tr>
  128.     <td class="textoinfo">Estado del inmueble</td>
  129.     <td><select name="miestado">
  130.     <option value="disponible"<?php if($fila['in_estado']=='disponible'){echo ' selected="selected"';} ?>>Disponible</option>
  131.     <option value="comprado"<?php if($fila['in_estado']=='comprado'){echo ' selected="selected"';} ?>>Comprado</option>
  132.     </select>
  133.     </td>
  134.   </tr>
  135. </table>
  136.  
  137. <table width="80%" align="center">
  138.   <tr>
  139.     <td><input type="submit" value="ACTUALIZAR" />
  140.       <input type="hidden" name="in_id" value="<?php echo $_GET['in_id'];?>" /></td>
  141.   </tr>
  142. </table>
  143.  
  144.  
  145. </form>
  146. </body>
  147. </html>



si alguien sabe o me puede ayudar gracias.

Última edición por gnzsoloyo; 28/05/2013 a las 19:03 Razón: Codigo sin etiquetar
  #2 (permalink)  
Antiguo 28/05/2013, 19:07
Avatar de gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 4 meses
Puntos: 2658
Respuesta: error de linea no se como quitarlo

OFF-TOPIC

PHP no es MySQL y en los foros de Bases de Datos no se debe postear código de programación.
Tu problema aparentemente es un fallo al evaluar el resultado de la consulta.
Pero eso no es tema de SQL o BBDD, sino de PHP.
Verifica:
1) Que la variable $_GET['in_id'] no esté entrando vacía o nula.
2) Que la consulta devuelva datos antes de usarla para generar el HTML


Muevo al foro de PHP.
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)

Etiquetas: php, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:01.