Como navegar nessa array
eai pessoal.. eu tenho uma array $select_news
com o print_r eu tenho isso aqui de retorno
Array (
[0] => 1
[id_noticia] => 1
[1] => Primeira Noticia [titulo_noticia] => Primeira Noticia
[2] => Raphael Godoi [autor_noticia] => Raphael Godoi
[3] => primeira [texto_noticia] => primeira
[4] => images/1.jpg [foto_noticia] => images/1.jpg
)
Array (
[0] => 2
[id_noticia] => 2
[1] => Segunda Noticia [titulo_noticia] => Segunda Noticia
[2] => Raphael Godoi [autor_noticia] => Raphael Godoi
[3] => segunda [texto_noticia] => segunda
[4] => images/1.jpg [foto_noticia] => images/1.jpg
)como num foreach eu poderia imprimir apenas a opção 'titulo_noticia' da 'Segunda Noticia'????
eu faço essa array com o seguinte codigo
function select($string){ //selecionando e retornando uma array
$qry = mysql_query($string) or die(mysql_error());
$out = array();
while($k = mysql_fetch_array($qry)){
$out = $k;
}
return $out;
}Discussão (1)
Carregando comentários...