Welcome to Dream.In.Code
Become a PHP Expert!

Join 150,170 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 2,299 people online right now. Registration is fast and FREE... Join Now!




some reason it wont change health in db.

 
Reply to this topicStart new topic

some reason it wont change health in db.

modern6
26 Aug, 2008 - 03:29 PM
Post #1

New D.I.C Head
*

Joined: 11 Jul, 2008
Posts: 33


My Contributions
hi i dont know but in this code its supost to change health is rand certain amount but it doesent and i dont know why can anyone help?
CODE
elseif($type==3){
$health =rand(10,15);
$newhp=$info->health-$health;
if($luck < 80){
mysql_query("UPDATE users SET health='$newhp' WHERE username='$username'");
echo "You failed your job and lost $health health!";
}elseif($info->points >= 0){
$newpoints=$info->points-0;
$rand =rand(24000,96000);
$newmoney=$info->money+$rand;
mysql_query("UPDATE users SET points='$newpoints' WHERE username='$username'");
mysql_query("UPDATE users SET money='$newmoney' WHERE username='$username'");
echo "You successfuly did your job and earnt $rand";
}}

User is offlineProfile CardPM
+Quote Post

CTphpnwb
RE: Some Reason It Wont Change Health In Db.
26 Aug, 2008 - 06:06 PM
Post #2

D.I.C Regular
Group Icon

Joined: 8 Aug, 2008
Posts: 481



Thanked: 32 times
My Contributions
1. Are you sure it's getting to the elseif part of the script?
2. What is this line?
$newhp=$info->health-$health;
3. What is this line?
}elseif($info->points >= 0){


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:04AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month