Ver Mensaje Individual
  #5 (permalink)  
Antiguo 03/05/2011, 14:20
Avatar de s00rk
s00rk
 
Fecha de Ingreso: octubre-2010
Ubicación: Mexico
Mensajes: 238
Antigüedad: 13 años, 5 meses
Puntos: 48
Respuesta: buscar registro en la base de datos

Bueno asi un ojo por encima deveria ser algo asi:

Código PHP:
Ver original
  1. <?PHP
  2. include("config.php");
  3. $link = Conectarse();
  4. $result = mysql_query("select * from bienes WHERE no_inventario='".$_POST['no_inventario']."'");
  5. //$result=mysql_query('select * from bienes where seccion="SALON1"',$link);
  6. ?>
  7.  
  8. <html>
  9. <head>
  10.    <title></title>
  11. </head>
  12. <body>
  13.   <CENTER> <TABLE BORDER=1 CELLSPACING=1 CELLPADDING=1>
  14.    
  15.       <TR><TD>&nbsp;NO_INVENTARIO</TD><TD>&nbsp;DESCRIPCION&nbsp;</TD><TD> ESTADO FISICO</TD><TD> RESGUARDANTE </TD> <TD>NIVEL</TD><td>SECCION</td></TR>
  16.         <TR> <TD colspan="6"> </TD></TR>
  17.           <TR> <TD colspan="6"></TD></TR>
  18.             <TR> <TD colspan="6"></TD></TR>
  19.               <TR> <TD colspan="6"></TD></TR>
  20.                 <TR> <TD colspan="6"></TD></TR>
  21. <?php      
  22.    while($row = mysql_fetch_assoc($result)) {
  23.        
  24.       echo "<tr> <td>&nbsp;".$row["no_inventario"]."</td> <td>&nbsp;".$row["descripcion"]."</td> <td>&nbsp;".$row["estado_fisico"]."</td> <td>                     &nbsp;".$row["resguardante"]."</td> <td>&nbsp;".$row["nivel"]."</td> <td>&nbsp;".$row["seccion"]."</td> </tr> ".$row["id_bienes"];
  25.    }
  26.    mysql_free_result($result);
  27.    mysql_close($link);
  28. ?>
  29. </table></CENTER>
  30. </body>
  31. </html>

Una de las cosas principales jamas ejecutas la query, luego el printf si podemos hacerlo directamente y es menos codigo y factible porque no hacerlo?

Otra cosa $_POST['no_inventario'] recuerda limpiar la variable antes de mandarla, porue si lo haces asi directamente puedes obtener una Inyeccion SQL(Hack), bueno espero y te sirva cualquier cosa aqui estamos n_n