Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 18, 2018 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/c72b0632f5f7cf579bcdb5d95646f6ae to your computer and use it in GitHub Desktop.
Save uno-de-piera/c72b0632f5f7cf579bcdb5d95646f6ae to your computer and use it in GitHub Desktop.
<?php
require_once("class/class.php");
$bus = new Buscador();
$buscame = $bus->buscar();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Resultado de la búsqueda</title>
<style type="text/css">
table{border:1px solid black; margin: 100px 0px 0px 160px}
th{background-color:#0000FF; color:#fff;}
td{background-color:#CCCCCC;}
</style>
</head>
<body>
<table>
<tr>
<th width="200px">Título del post</th>
<th width="200px">Autor de post</th>
<th width="400">Mensaje</th>
<th width="200px">Fecha de publicación</th>
</tr>
<?php
//COMPROBAMOS SI HAY REGISTROS EN LA BUSQUEDA, SI NO LOS HAY, MOSATRAMOS UN MENSAJE DICIENDO QUE NO HAY RESULTADOS, EN OTRO CASO, MOSTRAMOS LOS RESULTADOS
if(count($buscame)==0)
{
echo "<h2>No hay resultados para su búsqueda...</h2>";
}else{
for($i=0;$i<sizeof($buscame);$i++)
{
?>
<tr>
<td align="center">
<?php echo $buscame[$i]["titulo"] ?>
</td>
<td align="center">
<?php echo $buscame[$i]["autor"] ?>
</td>
<td align="center">
<?php echo $buscame[$i]["cuerpo"] ?>
</td>
<td align="center">
<?php echo $buscame[$i]["fecha"] ?>
</td>
</tr>
<?php
}
}
?>
</table>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment