View sourcecode

The following files exists in this folder. Click to view.

users.php

31 lines UTF-8 Unix (LF)
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
30
31
<?php
include("check_login.php");
include(
"db.php");

$stmt $pdo->query("SELECT * FROM users");
$users $stmt->fetchAll(PDO::FETCH_ASSOC);
?>

<h2>Användare</h2>

<a href="add_user.php">Skapa ny användare</a><br><br>

<table border="1" cellpadding="5">
<tr>
    <th>ID</th>
    <th>Användarnamn</th>
    <th>Redigera</th>
    <th>radera</th>
</tr>

<?php foreach ($users as $u): ?>
<tr>
    <td><?= $u['id'?></td>
    <td><?= $u['username'?></td>
    <td><a href="edit_user.php?id=<?= $u['id'?>">redigera</a></td>
    <td><a href="delete_user.php?id=<?= $u['id'?>">radera</a></td>
</tr>
<?php endforeach; ?>

</table>