diff --git a/shorten-url.php b/shorten-url.php index a5cd51a..44d364a 100644 --- a/shorten-url.php +++ b/shorten-url.php @@ -32,9 +32,7 @@ function getNextShortURL($s) { $result = $db->query('SELECT `slug` FROM `redirect` WHERE `url` = "' . $url . '" LIMIT 1'); if ($result && $result->num_rows > 0) { // If there’s already a short URL for this URL - $item = $result->fetch_object(); - echo SHORT_URL . $item->slug; - die(); + die(SHORT_URL . $result->fetch_object()->slug); } else { $result = $db->query('SELECT `slug`, `url` FROM `redirect` ORDER BY `date` DESC LIMIT 1'); if ($result && $result->num_rows > 0) {