richiec Posted July 14, 2007 Share Posted July 14, 2007 http://fearedwarlords.dks-gfx.com/timeframe/index.php if you go there and hover over one of the images you will see that it has a date and time on there... what i would like to do is... if the current date and time is before the one that is showing on the hover over, for it to display a different image, with no hover over. if the current date and time is after what the image says then it displays the color image. the images, time, date and name are all in the same sql table. can anyone give me an example of how i would do that? because i can not find anything. Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 14, 2007 Share Posted July 14, 2007 http://fearedwarlords.dks-gfx.com/timeframe/index.php if you go there and hover over one of the images you will see that it has a date and time on there... what i would like to do is... if the current date and time is before the one that is showing on the hover over, for it to display a different image, with no hover over. if the current date and time is after what the image says then it displays the color image. the images, time, date and name are all in the same sql table. can anyone give me an example of how i would do that? because i can not find anything. For each of your images/queries do something like: // if(strtotime('now') > strtotime("$mysql_date $mysql_time")) { if(strtotime('now') > strtotime('2000-01-01 00:00:00')) {// compares current unix timestamp to that date echo "<img src='hover.jpg'>"; // do the html code with the hover } else { echo "<img src='nohover.jpg'>"; // do the html code without the hover } Quote Link to comment Share on other sites More sharing options...
richiec Posted July 14, 2007 Author Share Posted July 14, 2007 ok i did that and changed one of the images to be a later date and left the rest to be before now and it still displays the same color image. this is the code.. $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo "<div align=\"center\">"; $count = 1; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $image2 =mysql_result($result,$i,"image2"); if ($count == 7){ //This is how columns you would like echo '<br>'; $count = 0; } // if(strtotime('now') > strtotime("$mysql_date $mysql_time")) { if(strtotime('now') > strtotime('2000-01-01 00:00:00')) {// compares current unix timestamp to that date echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; // do the html code with the hover } else { echo "<img src='$image2'>"; // do the html code without the hover } $count++; $i++; } echo '</div>'; $image is the color image, and $image2 is a grayed out version of the image. did i do something wrong? Quote Link to comment Share on other sites More sharing options...
trq Posted July 14, 2007 Share Posted July 14, 2007 if(strtotime('now') > strtotime($date)) { Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 14, 2007 Share Posted July 14, 2007 ok i did that and changed one of the images to be a later date and left the rest to be before now and it still displays the same color image. this is the code.. $result=mysql_query($query) or die(hmm); $num = mysql_num_rows($result); $i=0; echo "<div align=\"center\">"; $count = 1; while ($i < $num) { $name = mysql_result($result,$i,"name"); $date = mysql_result($result,$i,"date"); $time =mysql_result($result,$i,"time"); $image =mysql_result($result,$i,"image"); $image2 =mysql_result($result,$i,"image2"); if ($count == 7){ //This is how columns you would like echo '<br>'; $count = 0; } // if(strtotime('now') > strtotime("$mysql_date $mysql_time")) { if(strtotime('now') > strtotime('2000-01-01 00:00:00')) {// compares current unix timestamp to that date echo "<a href=\"#\" target=\"_parent\" title=\"$name is due on the $date at $time\"> <img src=\"$image\" />"; // do the html code with the hover } else { echo "<img src='$image2'>"; // do the html code without the hover } $count++; $i++; } echo '</div>'; $image is the color image, and $image2 is a grayed out version of the image. did i do something wrong? $mysql_date and $mysql_time need to equal the date and time retrieved from your mysql database Quote Link to comment Share on other sites More sharing options...
richiec Posted July 14, 2007 Author Share Posted July 14, 2007 if(strtotime('now') > strtotime($date)) { That worked, thank you both for the help :x Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.