Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Documento sin título</title>
- </head>
- <?php require "libreria.php";?>
- <link rel="stylesheet" href="estilo.css" type="text/css" />
- <body>
- <center>
- <h1>Consulta de Sueldo</h1>
- <form method="post" action="sueldazo.php">
- Ingrese Sueldo
- <input type="text" name="sueldo" />
- <input type="submit" value="Buscar" />
- </form>
- <?php
- //Verificar si existe la variable: codigo
- if (!isset($_POST["sueldo"])){
- say ("</body>");
- return;
- }
- //leer la variable: codigo
- $codigo = $_POST["sueldo"];
- //Conexion con la base de datos
- $cn = fnConnect( $msg );
- //Verificar la conexion con la base de datos
- if( !$cn ){
- fnShowMsg("Error", $msg );
- say("</body>" );
- return;
- }
- //Realizar consulta a la base de datos
- $sql = "select sueldo,nombre from empleado ";
- $sql .= "where sueldo>='$sueldo'";
- $rs = mysql_query( $sql );
- //Verificar si retorna resultado
- $rows = mysql_num_rows( $rs );
- if( $rows ==0 ){
- $msg = "sueldo ". $sueldo . " no existe.";
- fnShowMsg( "Mensaje", $msg );
- say( "</body>" );
- return;
- }
- if($sueldo>=3000){
- //Mostar resultado
- say( "<h2>Resultado</h2>" );
- say( "sueldo: $sueldo " );
- say( "<table border=1>" );
- say( "<tr>" );
- say( "<th>Sueldo</th>" );
- say( "<th>Nombre</th>" );
- say( "</tr>" );
- while ($row = mysql_fetch_row($rs)){
- say( "<tr>" );
- foreach($row as $celda){
- if(is_null($celda)){$celda = "none";}
- say( "<td>$celda</td>" );
- }
- say( "</tr>" );
- }
- say( "</table>" );
- }else{
- $msg = "sueldo ". $sueldo . " no existe.";
- fnShowMsg( "Mensaje", $msg );
- say( "</body>" );
- }
- ?>
- </center>
Advertisement
Add Comment
Please, Sign In to add comment