gamesipo

codigo :)

Aug 29th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Documento sin título</title>
  6. </head>
  7.  
  8.  
  9. <?php require "libreria.php";?>
  10. <link rel="stylesheet" href="estilo.css" type="text/css" />
  11. <body>
  12. <center>
  13. <h1>Consulta de Sueldo</h1>
  14. <form method="post" action="sueldazo.php">
  15. Ingrese Sueldo
  16. <input type="text" name="sueldo" />
  17. <input type="submit" value="Buscar" />
  18. </form>
  19. <?php
  20. //Verificar si existe la variable: codigo
  21. if (!isset($_POST["sueldo"])){
  22. say ("</body>");
  23. return;
  24. }
  25. //leer la variable: codigo
  26. $codigo = $_POST["sueldo"];
  27. //Conexion con la base de datos
  28. $cn = fnConnect( $msg );
  29. //Verificar la conexion con la base de datos
  30. if( !$cn ){
  31. fnShowMsg("Error", $msg );
  32. say("</body>" );
  33. return;
  34. }
  35. //Realizar consulta a la base de datos
  36. $sql = "select sueldo,nombre from empleado ";
  37. $sql .= "where sueldo>='$sueldo'";
  38. $rs = mysql_query( $sql );
  39. //Verificar si retorna resultado
  40. $rows = mysql_num_rows( $rs );
  41. if( $rows ==0 ){
  42. $msg = "sueldo ". $sueldo . " no existe.";
  43. fnShowMsg( "Mensaje", $msg );
  44. say( "</body>" );
  45. return;
  46. }
  47. if($sueldo>=3000){
  48.  
  49. //Mostar resultado
  50. say( "<h2>Resultado</h2>" );
  51. say( "sueldo: $sueldo " );
  52. say( "<table border=1>" );
  53. say( "<tr>" );
  54. say( "<th>Sueldo</th>" );
  55. say( "<th>Nombre</th>" );
  56. say( "</tr>" );
  57. while ($row = mysql_fetch_row($rs)){
  58. say( "<tr>" );
  59. foreach($row as $celda){
  60. if(is_null($celda)){$celda = "none";}
  61. say( "<td>$celda</td>" );
  62. }
  63. say( "</tr>" );
  64. }
  65. say( "</table>" );
  66. }else{
  67. $msg = "sueldo ". $sueldo . " no existe.";
  68. fnShowMsg( "Mensaje", $msg );
  69. say( "</body>" );
  70. }
  71. ?>
  72. </center>
Advertisement
Add Comment
Please, Sign In to add comment