Hi,
My query:
$query = "select * from
(
select * from students
union all
select * from students
) as tmp
order by rand() limit 5";
$myquery = mysqli_query($db_connect, $query);
while($students = mysqli_fetch_assoc($myquery)){
$stdid =$students['stdid']; $name = $students['name']; $dept = $students['dept'];
echo "<br><br>".$stdid."<br>".$name."<br>".$dept;
}
There are 20 rows for now. Many will be added later. I get 5 results but sometimes the results are repeated. I mean I get 5 rows, but some rows are repeated. I want the 5 results to be unique. How do I go about it?
Many thanks!