Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "oraclepr.uco.es";
- $username = "i52calei";
- $password = "***";
- $database = "i52calei";
- $conn = new mysqli ($host, $username, $password, $database);
- if ($conn->connect_error)
- die ($conn->connect_error);
- $sql = "SELECT nombre, apellidos, edad, DNI, salario, telefono, direccion FROM empresa";
- ?>
- <table border=1>
- <tr>
- <th>Nombre</th>
- <th>Apellidos</th>
- </tr>
- <?php
- $rows = $conn->query($sql);
- if(!$rows)
- die($conn->error);
- foreach($rows as $row){
- echo '<tr><td>'.$row["nombre"].'</td><td>'.$row["apellidos"].'</td><td><a href="detalles_empleado.php?nombre='.urlencode($row["nombre"]).'">Ver detalles</a></td></tr>';
- }
- echo "</table>";
- $conn = null;
- ?>
- <?php
- $host = "oraclepr.uco.es";
- $username = "i52calei";
- $password = "***";
- $database = "i52calei";
- $conn = new mysqli ($host, $username, $password, $database);
- if ($conn->connect_error)
- die ($conn->connect_error);
- $sql = "SELECT * FROM empresa where nombre=".$_GET["nombre"];
- $rows = $conn->query ($sql);
- if (!$rows)
- die ($conn->error);
- $row=$rows->fetch_assoc ();
- ?>
- <p><strong>Nombre: </strong><?php echo $row["nombre"]?></p>
- <p><strong>Apellidos: </strong><?php echo $row["apellidos"]?></p>
- <p><strong>Edad: </strong><?php echo $row["edad"]?></p>
- <p><strong>DNI: </strong><?php echo $row["DNI"]?></p>
- <p><strong>salario: </strong><?php echo $row["salario"]?></p>
- <p><strong>telefono: </strong><?php echo $row["telefono"]?></p>
- <p><strong>Direccion: </strong><?php echo $row["direccion"]?></p>
- <br/>
- <a href="empleados.php">Lista de Empleados</a>
- <?php
- $conn = null;
- ?>
- echo '<tr><td>'.$row["nombre"].'</td><td>'.$row["apellidos"].'</td><td><a href="detalles_empleado.php?nombre='.urlencode($row["nombre"]).'">Ver detalles</a></td></tr>';
Add Comment
Please, Sign In to add comment