Hi,
I have 2 pages that shows a table contents
On one, it shows the title and date with the following script
**************************************
<?
// includes
include("../regulations/conf.php");
include("../regulations/functions.php");
// abre liga��o � base de dados
$connection = mysql_connect($host, $user, $pass) or die ("Erro de execu��o.
Informe-nos sobre a situa��o!");
// escolhe a base de dados
mysql_select_db($db) or die ("Erro de execu��o. Informe-nos sobre a
situa��o!");
// gera e executa o pedido SQL
$query = "SELECT * FROM noticias ORDER BY id DESC LIMIT 6";
$result = mysql_query($query) or die ("Erro no pedido: $query. " .
mysql_error());
// se algum registo
if (mysql_num_rows($result) > 0)
{
// iterate atrav�s do conj resultados
// print titulo dos artigos
while($row = mysql_fetch_object($result))
{
?>
<tr>
<td width="7%" align="left"><font size="1" face="Arial"><img border="0"
src="images/ez1.jpg" width="18" height="16"></font></td>
<td width="7%" align="left"></td>
<td width="51%" align="left"> <font color="#808080" size="1" face="Arial"><a
href="http://www.ivao-pt.org/noticias/"><? echo $row->titulo;
?></font></a></td>
<td width="35%" align="left">
<p align="left"><font color="#808080" size="1" face="Arial"> <? echo
formatDate ($row->timestamp); ?></font></td>
</tr>
<tr>
<td width="100%" align="left" colspan="4"><br>
</td>
</tr>
<?
}
}
else
{
?>
<p align="center"><font size="1" face="Arial" color="#4F547A">Nenhuma
not�cia dispon�vel!</font></p>
<?
}
// fecha liga��o � base de dados
mysql_close($connection);
?>
*****************************************************
functions.php script
<?
// format MySQL DATETIME value into a more readable string
function formatDate($val)
{
$arr = explode("/", $val);
return date("d/m/y", mktime(0,0,0, $arr[1], $arr[2], $arr[0]));
}
?>
*****************************************************
On the other one, besides showing date and title, it shows also the text,
autor and some other stuff almost with same code
The problem is that on the one where only the title and date are shown, he
gives me always the same date, no matter if i posted yesterday or today. The
date is always 30/11/02
On the more detailed page, the date is shown correctly, today's date if
posted today, yesterday's date if posted yesterday.
Any idea for that? I checked the table, and the date is correct...i don't
know what else to do
Miguel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php