1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
   | <?php
$db = new PDO('mysql:host=localhost;dbname=portfolio', 'root', '');
 
$select = $db->query('SELECT id, name, slug FROM categories');
$categories = $select->fetchAll();
?>
 
<h1>Les catégories</h1>
 
<table>
	<thead>
		<tr>
			<th>id</th>
			<th>Nom</th>
			<th>Actions</th>
		</tr>
	</thead>	
	<tbody>
		<?php foreach($categories as $category): ?>
		<tr>
			<td><?php $category['id']; ?></td>
			<td><?php $category['name']; ?></td>
			<td>
				<a href="cat_edit.php?id=<?php $category['id']; ?>">Editer</a>
				<a href="?delete=<?php $category['id']; ?>">Supprimer</a></td>
		</tr>	
	<?php endforeach; ?>
	</tbody>
</table> | 
Partager