2
The tables:
- Ciencias (ex: Mathematics, Biology, Chemistry).
- Areas (e.g.: Algebra I, Biochemistry, Botany, Chemical Bonding).
- Exercises (e.g.: Water, Algae, Bryophytes, Progressions, Chemical Bonds).
To use as in this example [ Quadro 01 ] in html:
[ Table 01 ]
Mathematics
- Algebra I(1)
Biology
- Biochemistry(1)
- Botany(2)
Chemistry
- Chemical Bonds(1)
Note: In the table [exercises] there are exercises of all areas, that to be identified in relation to science tables and areas, I created columns such as: exercicioArea, exercicioCiencia.
The 'logic' I thought was to use the Inner Join I found in: http://www.w3schools.com/sql/sql_join_inner.asp to put the tables together like this:
SELECT *
ciencias.ciencia as cienciaNome,
areas.area as materiaNome,
exercicios.exercicio the exercicioNome
FROM science
INNER JOIN areas
ON areas.areaCiencia=ciencia.id
INNER JOIN exercises
ON exercises.exercicioArea = areas.id
ORDER BY scienceName ASC
To know the amount of exercises I found this way in: http://www.w3schools.com/php/func_array_count.asp
echo Count();
That in this case 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
However I am not able to understand how to mount [ Quadro 01 ] from the array, as for example there is 3 Biology in the array and in Quadro 01 only needed to put 1 time.
[ Table 01 ]
Mathematics
- Algebra I(1)
Biology
- Biochemistry(1)
- Botany(2)
Chemistry
- Chemical Bonds(1)
You only need to mount frame 01 from the mentioned array ?
– Ricardo Mota