I'm trying to echo a string inside a link, however it doesn't appear on the page. Here's my code:
<?php
$con = mysqli_connect("localhost","user","pass","db");
$term = mysqli_real_escape_string($con, $_GET['search']);
$sql = "SELECT * FROM `users` WHERE username LIKE '%".$term."%'";
$r_query = mysqli_query($con, $sql);
while ($row = mysqli_fetch_array($r_query)){
echo '<a href="user.php?username=' . $row['username'] . '>$row['username']</a>';
}
?>
The code previously worked when it just echoed echo $row['username'];