I am working on a function which fetch data from three table based on Left outer join, which is as follows:
public function get_full_category_history($id) {
$id = mysqli_real_escape_string($this->_con,$id);
if (isset($id) && $id != "") {
$query = "SELECT qz_categories.id as category_id, qz_categories.name as category_name, qz_quizzes.id as quiz_id, qz_quizzes.name as quiz_name, qz_questions.id as question_id, qz_questions.question as question FROM qz_categories LEFT OUTER JOIN qz_quizzes ON qz_categories.id = qz_quizzes.category_id LEFT OUTER JOIN qz_questions ON qz_quizzes.id = qz_questions.quiz_id WHERE ( qz_categories.id = '".$id."')";
}
$categoriesList = mysqli_query($this->_con, $query) or die(mysqli_error($this->_con));
$count = $categoriesList->num_rows;
$result = '';
$i = 0;
if ($count > 0) {
while($row = mysqli_fetch_array($categoriesList)){
$result[$i]['category_id'] = $row['category_id'];
$result[$i]['category_name'] = $row['category_name'];
$result[$i]['quiz_id'] = $row['quiz_id'];
$result[$i]['quiz_name'] = $row['quiz_name'];
$result[$i]['question_id'] = $row['question_id'];
$result[$i]['question'] = $row['question'];
$i++;
}
return $result;
}else{
return FALSE;
}
}
After doing this I got this array:
Array
(
[0] => Array
(
[category_id] => 1
[category_name] => Preschool
[quiz_id] => 1
[quiz_name] => What is Forex?
[question_id] => 1
[question] => In forex, what are the three main types of analysis?
)
[1] => Array
(
[category_id] => 1
[category_name] => Preschool
[quiz_id] => 1
[quiz_name] => What is Forex?
[question_id] => 2
[question] => Which type of analysis looks at historical price movements to determine the current trading conditions?
)
[2] => Array
(
[category_id] => 1
[category_name] => Preschool
[quiz_id] => 2
[quiz_name] => Why Trade Forex?
[question_id] =>
[question] =>
)
)
But what I want is:
Array
(
[0] => Array
(
[category_id] => 1
[category_name] => Preschool
['Preschool']=>Array(
0=> array(
[quiz_id] => 1
[quiz_name] => What is Forex?
[What is Forex?]=>Array(
0=>array(
[question_id] => 1
[question] => In forex, what are the three main types of analysis?
),
1=>array(
[question_id] => 2
[question] => Which type of analysis looks at historical price movements to determine the current trading conditions?
)
)
),
1=>array(
[quiz_id] => 2
[quiz_name] => Why Trade Forex?
[Why Trade Forex?]=>Array(
)
)
)
)
);
How to do that?

arraywithout index ??? just look afterWhat is Forex?