Right now i try to create php english vocabulary excercise on XAMPP
this is my code
$correct_answer = get_correct_answer_by_id($question['id']);
$wrong_answer = get_wrong_answer_by_unit($lesson_number);
$all_answer[] = $correct_answer;
while($w_ans = mysqli_fetch_assoc($wrong_answer))
{
$all_answer[] = $w_ans;
}
echo '<pre>';
var_dump($all_answer);
echo '</pre>';
and this is result
array(4)
{
[0]=>
array(5) {
["id"]=>
string(1) "4"
["vocab"]=>
string(7) "erosion"
["unit"]=>
string(1) "1"
["answer"]=>
string(24) "เธเธฑเธ”เธเธฃเนเธญเธ"
["position"]=>
string(5) "(n)
}
i don't know why answer = "เธเธฑเธ”เธเธฃเนเธญเธ" it should be "กัดกร่อน"
but if i didn't have this line
$all_answer[] = $correct_answer;
OR
while($w_ans = mysqli_fetch_assoc($wrong_answer))
{
$all_answer[] = $w_ans;
}
if i only use one of those command not both it didn't had any problems. And i didn't know why? May be someone please help me.