The tables:
- Science (eg Mathematics, Biology, Chemistry).
- Areas (eg Algebra I, Biochemistry, Botany, Chemical Bonding).
- Exercises (eg Water, Algae, Bryophytes, Progressions, Chemical Bonding).
To use as in this example [Table 01] in html:
[ Table 01 ]
Mathematics
- Algebra I (1) - Biology
- Biochemistry (1)
- Botany (2)
Chemistry
- Chemical Bonding (1)
Note: In the table [exercises] there are exercises from all areas , which to be identified in relation to the science and area tables, I created columns such as: exercise,
The 'logic' I thought is to use the inner join I found at: link to join the tables thus:
SELECT *
science.ciencia as scienceNome,
areas.area as materiaNome,
Exercises.Exercise ExercisesNome
FROM sciences
INNER JOIN areas
ON areas.areaCiencia = ciencia.id
INNER JOIN exercises
ON exercicios.exercicioArea = areas.id
ORDER BY scienceCome ASC
To find out the number of exercises I found this way at: link
echo count ( );
That in this case I would count the number of elements in the array.
Array
(
[0] => Array
(
[cienciaNome] => Biologia
[materiaNome] => Bioquímica
[exercicioNome] => Água
)
[1] => Array
(
[cienciaNome] => Biologia
[materiaNome] => Botânica
[exercicioNome] => Algas
)
[2] => Array
(
[cienciaNome] => Biologia
[materiaNome] => Botânica
[exercicioNome] => Briófitas
)
[3] => Array
(
[cienciaNome] => Matemática
[materiaNome] => Algebra I
[exercicioNome] => Conceito Progressões
)
[4] => Array
(
[cienciaNome] => Química
[materiaNome] => Ligações Químicas
[exercicioNome] => Conceito Ligações Químicas
)
)
Contagem array = 5
But I can not figure out how to mount [Frame 01] from the array, for example there is 3 Biology in the array and in Frame 01 you only need to put it 1 time.
[ Table 01 ]
Mathematics
- Algebra I (1) - Biology
- Biochemistry (1)
- Botany (2)
Chemistry
- Chemical Bonding (1)