Zitat:
|
nach x tagen verschwindet das image wider. ich habe das so gelöst
|
mit mySQL sieht das ganze so aus:
echo '<table border="1">';
$q = mysql_query ("select *, if(LINKS.DATUM>date_sub(curdate(), interval $verfall days), '*', '<img src=\"neu.gif\">') as NEUGIF from LINKS");
while ($x = mysql_fetch_array($q)) echo "<tr><td>$x[NEUGIF]</td><td><a href=\"$x[LINKURL]\">$x[LINKNAME]</a></td></tr>";
echo '</table>';
so hast du dein neu.gif bei allen neuen und überläßt die ganze Arbeit mySQL ... geht im Allgemeinen schneller.
Wenn du nur die neuen haben willst, sieht das so aus:
echo '<table border="1">';
$q = mysql_query ("select * from LINKS where DATUM>date_sub(curdate(), interval $verfall days)");
while ($x = mysql_fetch_array ($links)) echo "<tr><td><a href=\"$x[LINKURL]\">$x[LINKNAME]</a></td></tr>";
echo '</table>';
noch mehr Spaß mit mysql, Datum und Zeit:
http://www.mysql.com/documentation/m...time_functions