コード例 #1
0
<?php

session_start();
if (validadora::validarSesionActual()) {
    require_once "clases/AccesoDatos.php";
    require_once "clases/cd.php";
    $arrayDeCds = cd::TraerTodoLosCds();
    echo "<h2> Bienvenido: " . $_SESSION['registrado'] . "</h2>";
    ?>
<table class="table"  style=" background-color: beige;">
	<thead>
		<tr>
			<th>Editar</th><th>Borrar</th><th>cantante</th><th>disco</th><th>año</th>
		</tr>
	</thead>
	<tbody>

		<?php 
    foreach ($arrayDeCds as $cd) {
        echo "<tr>\n\t\t\t<td><a onclick='EditarCD({$cd->id})' class='btn btn-warning'> <span class='glyphicon glyphicon-pencil'>&nbsp;</span>Editar</a></td>\n\t\t\t<td><a onclick='BorrarCD({$cd->id})' class='btn btn-danger'>   <span class='glyphicon glyphicon-trash'>&nbsp;</span>  Borrar</a></td>\n\t\t\t<td>{$cd->cantante}</td>\n\t\t\t<td>{$cd->titulo}</td>\n\t\t\t<td>{$cd->año}</td>\n\t\t</tr>   ";
    }
    ?>
	</tbody>
</table>

<?php 
} else {
    echo "<h4 class='widgettitle'>No estas registrado</h4>";
}