0
Why my WHILE is displaying only one record (are two records!)
$resultnome = mysql_query("
select DIVU.DIVU_NM_DIVULGACAO, DIVU.DIVU_DS_LOGRADOURO, DIVU.DIVU_DS_NUMERO, DIVU.DIVU_DS_TELEFONES, DIVU.ID_PRESTADOR_DIVULGACAO, SERVI.SERV_NM_SERVICO, TISE.ID
from DIVULGACAO DIVU
LEFT JOIN SERVICO SERVI ON DIVU.ID = SERVI.ID_DIVULGACAO
LEFT join TIPO_SERVICO TISE ON SERVI.ID_TIPO_SERVICO = TISE.ID
WHERE DIVU.DIVU_NM_DIVULGACAO = 'MeuTexto' AND TISE.ID = 3
") or die(mysql_error());
$rows = mysql_fetch_array($resultnome);
$nomeunidade = $rows['DIVU_NM_DIVULGACAO'];
$enderecounidade = $rows['DIVU_DS_LOGRADOURO'];
$numerounidade = $rows['DIVU_DS_NUMERO'];
$telefoneunidade = $rows['DIVU_DS_TELEFONES'];
echo '<strong>'.$nomeunidade.'</strong><br>';
while($rows = mysql_fetch_array($resultnome))
{
echo $rows['SERV_NM_SERVICO'];
}
echo '<br><span class="glyphicon glyphicon-map-marker"></span> '.$enderecounidade.', '.$numerounidade.'<br>';
echo '<span class="glyphicon glyphicon-earphone"></span> Tel. '.$telefoneunidade.'<br>';
Could post a variable output
$resultespecialidade
? she returns inarray
?– MeuChapeu
What you can do is return in object form and use the
foreach
to show.– MeuChapeu
Post the variable output
$resultnome
, post in the question that is easier to understand.– MeuChapeu
I improved the question... I made it more objective.
– Fellipe J. de Sousa
You have two
mysql_fetch_array
, one of them before thewhile
. This first moves the pointer to the second record.– bfavaretto