?
Solved

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

Posted on 2006-07-23
4
Medium Priority
?
403 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

719 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