Trying not to print duplicate values from a field in my table.
if (mysqli_num_rows($result) > 0) {
// fetches a result row as an assosiative array
while ($row = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>" . $row["id"] . "</td>";
echo "<td>" . $row["first_name"] . "</td>";
echo "<td>" . $row["last_name"] . "</td>";
echo "<td>" . $row["book_id_fk"] . "</td>";
echo "<td>" . $row["quantity"] . "</td>";
echo "<td>" . $row["grade"] . "</td>";
;
}
i tried using array_unique function echo "" . array_unique( $row["student_id_fk"]) . "";
but my error message is
array_unique() expects parameter 1 to be array, string given
Can anyone help me with this. How do I pass in the array and not a string?