Hi all,
Can anyone see the problem with the following?
Lets say I have a field (amongnst other fields) in a mysql DB called movie_release_date. I have two different entries, one is 2001-03-14 and the other is 2003-10-26.
The following is the code i use to display a particular image(button) depending on the date:
<?
$query = "SELECT * FROM movie, movie_genre WHERE movie.movie_id=movie_genre.movie_id AND movie_genre.genre_id='$new_genre_id' ORDER BY movie_title DESC LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
$totalpagerows = mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
$movie_id = $row["movie_id"];
$title = $row["movie_title"];
$movie_release_date = $row["movie_release_date"];
$class = $row["movie_classification"];
$current_date = mktime();
$movie_release_date = date($movie_release_date);
//$movie_release_date = mktime($movie_release_date);
if($current_date >= $movie_release_date){
?>
<? echo $current_date ?> <? echo $movie_release_date ?><IMG alt=Preorder src="images/preorder_button.gif" border=0>
<?
} else {
?>
<? echo $current_date ?> <? echo $movie_release_date ?><IMG alt=Add to Cart src="images/add_cart_button.gif" border=0>
<?
}
?>
Now for the problem. When i remove the line
$movie_release_date = mktime($movie_release_date);
the date displayed corresponds with that movies release date (ie. two different date values).
But when i add the line
$movie_release_date = mktime($movie_release_date);
the values displayed for each release date of the movie are the same.
How do i get the UNIX timestamp to display the correct values (they should be two different values)?
Any ideas greatly appreciated.
Cheers,
micmac