I need to compare two arrays that come back from MySQL, but one of them is coming back with several strange items, making my comparison impossible. I have already filtered the search to return only the field I want, but there is no way ...
Take a look at the code to understand it 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's 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 made 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 this data that is being registered in other sectors of the system, but I only need the last three in this array ... Does anyone know what it can be?