$vars = $db->query("SELECT * FROM `agent` WHERE `agent_id`='{$id}'");
//$arr = array();
$vars = $vars->fetch();
$awards = explode(',', $vars['achievements']); //Пихаем данные в массив
// echo $profile['achievements'];
//print_r($awards);
$num = 0;
$count_aw = count($awards);
for($i = 0; $i < $count_aw; $i++){
$aw = $db->query("SELECT * FROM `achievement` WHERE `id`='{$awards[$i]}'");
$aw = $aw->fetch();
echo '<img src="/images/achievement/'.$aw['achievementImg'].'" width="50" height="50" > ';
}
<?php
include 'connect.php';
$vars = $db->query("SELECT * FROM `agent` WHERE `id`='1'");
$arr = array();
while($vars = $vars->fetch()){
array_push($arr, $vars['achivments']);
print_r($arr);
}
?>
while($get = $getQuestions->fetch())
{
echo ' <div class="test">
<h4>'.$get['question'].'</h4>
<hr>
<div class="form-group">
<ol start="1">
';
$getAnswers = $s_db->query("SELECT * FROM `reg_answers` WHERE `question_id`='{$get['id']}'");
while($row = $getAnswers->fetch()){
echo "<li>{$row['text']}</li>";
}
echo '
<br>
</ol>
<input class="form-control" name="answer_1" placeholder="Ответ">
<input type="hidden" id="id_1" value="'.$get['id'].'">
</div>
</div>
<br>
<hr>';
}
Например
1 - 256
2 - 100
8 - 94
3 - 56