Jump to content


Recently Updated Category


2 replies to this topic

#1 Cosmic G

    Young Padawan

  • Members
  • Pip
  • 20 posts
  • Gender:Male

Posted 07 July 2005 - 08:59 PM

I'd like to know how to mark a recently updated category for a 3 days (ex: an * will be used to mark a recently updated categ)... It's in PHP and MySQL.
Below is a part of the wallpapers page where it displays the category/series. Could anyone help me how to code it?

<?php

case 'series'; // list all wallpapers series
?>
<p class="head">Wallpapers Sorted By Series</p>
<?php
$qseries = "SELECT * from wp_series order by series_name asc ";
$rseries = mysql_query($qseries);
while($row=mysql_fetch_array($rseries))
{
	extract($row);
?>
	&raquo; <a href="wallpapers.php?mode=show&series_id=<?php echo $series_id; ?>"><?php echo $series_name; ?></a>
<?php
	$query = "SELECT count(*) FROM wallpapers where anime='$series_id' ";
	$ret = mysql_query($query) or die (mysql_error());
	$entry_count = mysql_fetch_row($ret);
    
	// wallpaper count
	echo " [{$entry_count[0]}]<br>";
}

break;

?>


#2 MillerTime

    Young Padawan

  • Members
  • Pip
  • 69 posts

Posted 09 July 2005 - 05:29 PM

well i have never doen this but this is how i would go about it (not going to make a whole code)..

add a new field in your table called, updated_date, then in your file that inserts the data into the table make it insert the current date (pick a format that uses numbers only)..

Then when viewing the categories, make the file get the current date (same format as before) and compare it with the date in the table and if its equal rto three or less than three then have it put a start or something..

its hard to explain

#3 Cosmic G

    Young Padawan

  • Members
  • Pip
  • 20 posts
  • Gender:Male

Posted 11 July 2005 - 03:41 AM

I kinda get what you mean...
So everytime I add a new entry to the database, it would also update the updated_date field on the mysql table... and it's numbers...
Hmmm... let's say it in this format (YYYYMMDD: e.g. 20050709)...
Then when displaying it... a PHP code would get the current date in the format as same as above and get the update_date on the table then it would subtract the current date from the last update_date... *confused*... so it'll be like:

example:
(current date) - (update_date) = answerdate
so if "answerdate" is less than or equal to 3 it would display an asterisk... O_o

Is that right?

[EDIT]
Huraay! Thanks a lot MillerTime. It worked... ^__^ Anyways, you could see it here http://b-moon.uni.cc...php?mode=series when the revamp is over. That'll be in a few hours... Thanks again!

Edited by Cosmic G, 11 July 2005 - 04:31 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users