I'm trying to pull in some data from my database, and the loop is behaving strangely. this is
my code:
<code>
$query = "SELECT DISTINCT * FROM users WHERE username LIKE '%$search%'";
$resultpage = "";
$result = mysqli_query($con,$query);
$rows = array();
$resultpage = "<table class='table table-striped table-hover><tbody><tr><td>Search Results</td></tr>";
while($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
foreach($rows as $row) {
foreach($rows as $field => $value) {
array_unique($rows);
$resultpage .= "<tr><td><a href='user?id=".$value["id"]."'>".$value["username"]."</a></tr></td>";
}
}
}
</code>
You can see what is output here.
Basically, there are patterns of duplicate entries, and some of the entries don't even appear until you get farther down the list.
Thanks for any help