Jump to content
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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.