rhinez0rz
asked on
TIMEDIFF: Good Way to Stop Negative Time from Showing (using php & mysql)
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_Resourc e_Gold_tim e, $Killercube) or die(mysql_error());
$Resource_Gold_time_result = mysql_fetch_array($Resourc e_Gold_tim e);
////Time Diff////////////////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////// ////////
?>
<p>Time to upgrade: <?php if ($Resource_Gold_time_resul t['date_di ff_gold']< =0){ // Show if the timediff is =>0
echo $Resource_Gold_time_result ['date_dif f_gold'];
}?>
<?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_Resourc
$Resource_Gold_time_result
////Time Diff//////////////////////
?>
<p>Time to upgrade: <?php if ($Resource_Gold_time_resul
echo $Resource_Gold_time_result
}?>
If you've answered your own question, ask community support to paq and refund the points.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
$Resource_Gold_time_result
I didnt use the single quotes around the 0, this appears to work.