I have two arrays that return a MySQL query. I need to compare these two results so that, each time they are different, they print something on the screen. The problem is that the query that comes back from the database is an array with several fields, so I have to go through both.
I was trying to do this:
include_once 'classes/trabalhosclass.php';
if(!isset($_SESSION)){ session_start(); }
$idTrabalho = $_SESSION['SemestreGeral'];
$Busca = '';
$oTrabalho = new trabalhosclass();
$oTrabalho -> listarAvancado($Busca, $idSemestre);
while ($arrayTrabalhos = mysql_fetch_array($oTrabalho->retorno())){
$array1[] = $arrayTrabalhos['orientador'];
}
include_once 'classes/professoresclass.php';
$aux = '';
$oProfessor = new professoresclass();
$oProfessor -> listar($aux);
while ($arrayProfessores = mysql_fetch_array($oProfessor->retorno())){
$array2[] = $arrayProfessores['Nome'];
}
$result = array_diff($array1, $array2);
print_r($result);
But it did not work ... Would it have a different shape? I needed the $ result there to appear all the names that are in one and not the other lists ...