diff options
| author | ilotterytea <iltsu@alright.party> | 2025-04-21 17:15:37 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-04-21 17:15:37 +0500 |
| commit | 3c97031c879a227018dbdc4189b896a0a8998b06 (patch) | |
| tree | 09b17c7b9322876730d77338ca22117d2e2f59c5 | |
| parent | f496c838d202e16f65b6efa6207b877f0596ae1e (diff) | |
feat: display channels in emote page
| -rw-r--r-- | src/emotes/single_page.php | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/emotes/single_page.php b/src/emotes/single_page.php index 3fa0a30..d338565 100644 --- a/src/emotes/single_page.php +++ b/src/emotes/single_page.php @@ -130,11 +130,31 @@ include_once "../../src/config.php"; <section class="box"> <div class="content"> - <p>Added in <?php echo 20 ?> channels</p> + <?php + $db = new PDO(DB_URL, DB_USER, DB_PASS); + $stmt = $db->prepare("SELECT users.id, users.username + FROM users + INNER JOIN emote_sets AS es ON es.owner_id = users.id + INNER JOIN emote_set_contents AS ec ON ec.emote_set_id = es.id + WHERE ec.emote_id = ?"); + + $stmt->execute([$emote->get_id()]); + $count = $stmt->rowCount(); + + $db = null; + + if ($count > 0) { + echo "<p>Added in $count channels</p>"; + } else { + echo "No one has added this emote yet... :'("; + } + ?> <div class="items row"> - <a href="/users/1">forsen</a> - <a href="/users/2">not_forsen</a> - <a href="/users/3">lidl_forsen</a> + <?php + while ($row = $stmt->fetch()) { + echo '<a href="/users/' . $row["id"] . '">' . $row["username"] . '</a>'; + } + ?> </div> </div> </section> |
