Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TIMEDIFF: Good Way to Stop Negative Time from Showing (using php & mysql)

Posted on 2006-07-23
4
Medium Priority
?
407 Views
Last Modified: 2013-12-12
Could you tell me how I could stop showing the countdown of time on my webpage once the timer hits 0 seconds? The following IF statement in the body doesnt hide the timer once the time difference hits a negative value.

<?php
////Time Diff////////////////////////////////////////////////////////////////////////////////////////////////////
$query_Resource_Gold_time ="SELECT TIMEDIFF(upgrade_date, now())AS date_diff_gold
FROM tbl_resource_gold WHERE village_id = '" . $colname_Resource_Gold . "'";
$Resource_Gold_time = mysql_query($query_Resource_Gold_time, $Killercube) or die(mysql_error());
$Resource_Gold_time_result = mysql_fetch_array($Resource_Gold_time);

////Time Diff////////////////////////////////////////////////////////////////////////////////////////////////////
?>
  <p>Time to upgrade: <?php if ($Resource_Gold_time_result['date_diff_gold']<=0){ // Show if the timediff is =>0
                              echo $Resource_Gold_time_result['date_diff_gold'];
                              }?>
0
Comment
Question by:rhinez0rz
4 Comments
 

Author Comment

by:rhinez0rz
ID: 17164147
Got it -

$Resource_Gold_time_result['date_diff_gold']>='0'

I didnt use the single quotes around the 0, this appears to work.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17166482
If you've answered your own question, ask community support to paq and refund the points.
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17693546
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question