TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-06-2008, 05:16 AM   #1 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default 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>

Last edited by Wildhoney : 12-06-2008 at 06:22 PM. Reason: Good call, Tanax
KingOfTheSouth is offline  
Reply With Quote
Old 12-06-2008, 04:54 PM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Try changing from [code] to [php] or [highlight=php].
__________________
Tanax is offline  
Reply With Quote
Old 12-06-2008, 06:23 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

What do you mean by a timer?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
Old 12-06-2008, 08:24 PM   #4 (permalink)
The Acquainted
 
KingOfTheSouth's Avatar
 
Join Date: Oct 2008
Location: Cincinnati
Posts: 151
Thanks: 14
KingOfTheSouth is on a distinguished road
Default

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.
KingOfTheSouth is offline  
Reply With Quote
Old 12-07-2008, 03:22 PM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

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.
__________________
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how many programming languages do you know fluently? sarmenhb General 12 12-10-2008 06:26 AM
If a programming language was a boat… Wildhoney The Lounge 9 04-05-2008 07:24 AM
The speed of programming Devels General 1 02-01-2008 10:56 PM
Programming Software Rendair General 2 12-03-2007 05:44 PM
12 common programming mistakes to avoid sunilbhatia79 General 0 11-16-2007 05:59 PM


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

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design