Solved

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

Posted on 2006-07-23
4
400 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.
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 …

626 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