TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   My programming (http://www.talkphp.com/general/3725-my-programming.html)

KingOfTheSouth 12-06-2008 05:16 AM

My programming
 
Hello again everyone:-) I have a new problem I just made a new feature for my game. But I am having a problem adding a timer in the code. Here is the code if you could help me it would be much appreciated.
php Code:
<?
include("game_html.php");$game="yes";
mysql_query("UPDATE $tab[pimp] SET currently='At the hospital', online='$time' WHERE id='$id' AND rid='$rid'");


$user = mysql_fetch_array(mysql_query("SELECT * FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$hospital = mysql_fetch_array(mysql_query("SELECT * FROM hospital WHERE id='$id' AND rid='$rid';"));


if($doit)

    {

    $afford = $heal * 500;

        if ($user[cash] < $afford)
         { $msg="You dont have that much cash!"; }
        elseif ($user[cash] <= 0)
         { $msg="You dont have that much cash!"; }
        elseif ($heal == 0)
         { $msg="You havent entered an amount to heal"; }
        elseif (!preg_match('/^[0-9][0-9]*$/i', $heal))
         { $msg="dont do that.....";}

        else
        {
         $msg="Bouncers have been healed!";

                    if($heal == $hospital[in_bounce])
                    {
                    mysql_query("UPDATE $tab[pimp] SET thugs=thugs+$heal, cash=cash-$afford WHERE id='$id' AND rid='$rid'");
                    mysql_query("DELETE FROM hospital WHERE id='$id' AND rid='$rid'");
                    }
                    elseif($heal < $hospital[in_bounce])
                    {
                    mysql_query("UPDATE $tab[pimp] SET thugs=thugs+$heal, cash=cash-$afford WHERE id='$id' AND rid='$rid'");
                    mysql_query("UPDATE hospital SET in_bounce=in_bounce-$heal WHERE id='$id' AND rid='$rid'");
                    }
        }
    }


secureheader();
?>

<form method="post" action="hospital.php?rid=<?=$rid?>">
<font size="+1"><b>Hospital</b></font>
<br>
<br><font color="#FFCC00"><?=$msg?></font><br>

<font color="#8F92E8">

</font>
<br>You have <font color="8F92E8"><b><?=commas($hospital[in_bounce])?></font> bouncers</b> injured in the hospital. They will start to die in XXXXXXX time.
</nobr>
<br>
<br>


<table width="80%" border="0">

 <tr>

        <td>

Tanax 12-06-2008 04:54 PM

Try changing from [code] to [php] or [highlight=php].

Wildhoney 12-06-2008 06:23 PM

What do you mean by a timer?

KingOfTheSouth 12-06-2008 08:24 PM

A cron where it says They will start to die in XXXXXXX time. I want a cron or something like a countdown timer that will count down from 20 minutes.

Tanax 12-07-2008 03:22 PM

The actual countdown, must be with JavaScript.
However, the calculation of when to display that, and/or how many seconds it will countdown from can be done with PHP.


All times are GMT. The time now is 05:04 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0