public function buscarMateriaProva($codigoProva){
$query = " SELECT codigoMateria, codigoProva, quantidadeQuestao
FROM materiasProvas
WHERE codigoProva = ".$codigoProva;
//se for executado
if($res = mysql_query($query)){
$row = mysql_fetch_row($res);
$nr = (int)mysql_num_rows($res);
#se houver registro povoa o obj, senão retorna falso
if($nr === 0){
return false;
} else {
return $res;
}
} else {
return false;
}
}
In this case, $ nr has a value of 3, since there are 3 records, so far so good.
The value returns to my file where I mount the structure using mysql_fetch_array ():
$ resMateriaProva = $Profile-> searchProfile ($ code);
while($arrayMateriaProva = mysql_fetch_array($resMateriaProva)){
print_r($arrayMateriaProva);
}
It returns all 3 records, normal, but only displays the last 2, ignoring the first record.
Does anyone know what the error is?
Thanks in advance!