Jump to content
Sign in to follow this  
N3lson

Função em loop

Recommended Posts

N3lson

Bom dia

Criei esta função para acertar a disposição da data recolhida da base de dados mas em vez de colocar as datas em loop da tabela coloca-as em linha

function data($elemento)
{
$split = split('-',$elemento);
echo $split['2'],'.',$split['1'],'.',$split['0'];
}

	 echo '<div id="infobox">';	
$ult_socio = mysql_query("SELECT * FROM socios ORDER BY id DESC LIMIT 4");
echo '<h3>Últimos Associados</h3>';
echo "<table border='0' cellpadding='3' cellspacing='0' >";
echo '<thead><tr>';
echo "<th width=\"16px\">x</th><th>Nome</th><th width=\"30px\">Admissão</th></tr></thead><tbody>";
while($tab_ult = mysql_fetch_array($ult_socio))
{
echo"<tr>";
echo '<td><img src="./img/icons/user.png"></td>';
echo"<td><em><a href='socios.php?socio=".$tab_ult['numero']."#tab1'>". ucwords($tab_ult['nome'])."</a></em></td>
<td align=\"center\"><em>". data($tab_ult['admissao'])."</em></td>";
echo "</tr>";
}
echo"</tbody></table>";	
echo '</div>';

Edited by yoda

You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it.

Share this post


Link to post
Share on other sites
N3lson

Mas eu estou a chama-la na tabela no local indicado mas teima em escrever antes e ignora completamente a tag ?

O que poderei alterar para resolver isso ?

Pois essa função irá ser aplicada em diversas paginas uns em Tabela outros em Listas

Edited by N3lson

You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it.

Share this post


Link to post
Share on other sites
N3lson

Desculpa mas não percebi

Oops percebi

function data($elemento)
{
$split = explode('-',$elemento);
$retorno = $split['2'].'.'.$split['1'].'.'.$split['0'];
return $retorno;
}

Obrigado

Edited by yoda

You can't do it, kid. But don't worry, my boy. You're not the only one. No one else can do it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.