显示未重复与数据库链接的行

I am new in php. I make a quiz app and I want to show questions that is not repeated again . here's my code. Please help me to show require result.

<?php
include('connect.php');
$sql = "SELECT * FROM quiz_question WHERE theme_id= 2 ORDER BY RAND ()";
$result = $conn->query($sql);
  if ($result->num_rows > 0) {
   // output data of each row
   while($row = $result->fetch_assoc()) {
     $id =  $row['id'];

       echo "
       <h2>" . $row["question"]. "</h2>";
       break;

     }
   }
   $check_id = array ($row['id']);
   echo $check_id['0'];
     if(array ($row['id']) == $check_id){
       echo "no question ";
     }
     else{
       echo "
       <h2>" . $row["question"]. "</h2>";
     }
?>

Your question is not clear. But I guess, you can solve it by array_unique($array).

array_unique($array);

<?php
  include('connect.php');
  $sql = "SELECT * FROM quiz_question WHERE theme_id= 2 ORDER BY RAND ()";
  $result = $conn->query($sql);
  if ($result->num_rows > 0) {
    // output data of each row
     while($row = $result->fetch_assoc()) {
     $id =  $row['id'];
     $question = $row['question'];

     echo "
      <h2>" . $row["question"]. "</h2>";

     $check_id = array($id);
    }
  }

  $check_id_unique=array_unique($check_id);
?>