Jump to content
Fórum Script Brasil
  • 0

Resultados XML


MTavares
 Share

Question

Colegas.

Estou trazendo do banco as notas dos alunos que estão da seguinte forma:

C,D,A,C,A,E,A,B,C,C,B,D,A,C,D,D,B,B,B,A

E essas notas são comparadas com um arquivo XML que estou buscando dessa forma:

<?php

$xml = simplexml_load_file($arquivoXML);

$contar = 0;
    $notasAlunos = explode(',',$aluno->avaliacao_respostas);
    foreach($xml->avaliacao->disciplina as $disciplina) {
           echo $disciplina->attributes()->nome.":<br>";
           foreach ($disciplina as $questao) {
                    foreach($notasAlunos as $notaAluno){ // Aqui trago as notas dos alunos
                            if($questao->resposta == $notaAluno){ // aqui verifico se as questões do gabarito é igual a nota do aluno
                               $conta = $contar++;                       
                           }                
                    }   
           }
    }
echo $conta;

Porém preciso fazer com que as notas dos alunos sejam contabilizadas conforme as disciplinas. Ex.: Matemática 3 acertos, Física 4 acertos...

Não estou conseguindo....

 

 

 

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Forum Statistics

    • Total Topics
      149.6k
    • Total Posts
      646.2k
×
×
  • Create New...