0
I need to compare two arrays that come back from Mysql, but one of them is coming back with several strange items, making it impossible to compare. I already trained in the search to return only the field that I want, but there is no way...
Take a look at the code to understand better:
public function listarNomes(){
$oConexao = new conexaoclass();
$oConexao -> abrirConexao();
$this -> sql = "SELECT Nome FROM Professores
ORDER BY Nome;";
$this -> resultado = mysql_query($this -> sql, $oConexao -> getConn());
}
Here comes the call:
include_once 'classes/professoresclass.php';
$oProfessor = new professoresclass();
$oProfessor ->listarNomes();
while ($arrayProfessores = mysql_fetch_array($oProfessor->retorno())){
$array2[] = $arrayProfessores['Nome'];
}
foreach ($array2 as $key => $value) {
echo 'teste<br>';
}
I have only 3 names registered in the database but this 'test' appears several times... I did a var_dump() in array2 and the following appears:
array (size=11)
0 => string '1' (length=1)
'idSemestre' => string '1' (length=1)
1 => string '2014/2' (length=6)
'Nome' => string '2014/2' (length=6)
2 => string '2014-11-28' (length=10)
'DataDeInicio' => string '2014-11-28' (length=10)
3 => string '2014-12-05' (length=10)
'DataDeTermino' => string '2014-12-05' (length=10)
4 => string 'Administrador Máximo' (length=21)
5 => string 'Carlos Maltz' (length=12)
6 => string 'João Sem Braço' (length=16)
I really have these data that are coming to more registered in other sectors of the system, but I only need the last three in this array... Does anyone know what it can be?
Yeah, but there’s something weird there... Because I do the same thing in another array, in array1 there in that code and it works, just comes the field I want... I will edit the question and put this array1 for you to take a look
– Alceu