Hey,
Ich habe ein Array in PHP programmiert, welches per MySQL alle Sachen selektiert.
Nun werden aber die Arrays nicht gefunden.
Code:
$stmt = $link->prepare('SELECT * FROM tickets ORDER BY created DESC');
$stmt->execute();
$resultSet = $stmt->get_result();
// pull all results as an associative array
$tickets = $resultSet->fetch_all();
<?php foreach ($tickets as $ticket): ?>
<a href="view.php?id=<?= $ticket['id'] ?>" class="ticket">
<span class="con">
<?php if ($ticket['status'] == 'open'): ?>
<i class="far fa-clock fa-2x"></i>
<?php elseif ($ticket['status'] == 'resolved'): ?>
<i class="fas fa-check fa-2x"></i>
<?php elseif ($ticket['status'] == 'closed'): ?>
<i class="fas fa-times fa-2x"></i>
<?php endif; ?>
</span>
<span class="con">
<span class="title"><?= htmlspecialchars($ticket['title'], ENT_QUOTES) ?></span>
<span class="msg"><?= htmlspecialchars($ticket['msg'], ENT_QUOTES) ?></span>
</span>
<span class="con created"><? date('F dS, G:ia', strtotime($ticket['created'])) ?></span>
</a>
Fehler:
C:\xampp\htdocs\ticket.php on line 271
" class="ticket">
Warning: Undefined array key "status" in C:\xampp\htdocs\ticket.php on line 273
Warning: Undefined array key "status" in C:\xampp\htdocs\ticket.php on line 275
Warning: Undefined array key "status" in C:\xampp\htdocs\ticket.php on line 277
Warning: Undefined array key "title" in C:\xampp\htdocs\ticket.php on line 282
Warning: Undefined array key "msg" in C:\xampp\htdocs\ticket.php on line 283
Kann mir jemand sagen, ob ich etwas übersehen habe?