Look at your code. You are using the variable
$question
in three different places for three different purposes ...
$sql12query =$question->query("SELECT DISTINCT question FROM questions WHERE uniq_name='" . $question . "'");
while ($row12 = $sql12query->fetch_array()) {
$question = $row12[0];
... which will lead to all sorts of problems.