Jump to content

[SOLVED] Not updating database


SoireeExtreme

Recommended Posts

I've created an attack script for a game. Players attack Creatures it reads out who won/lose or if the battle is a draw, and its suppose to update certain things in the database such as gold/credits number of turns and such.

 

Well everything works find except 1 part in the updating process. I have the script go into the database and get info on how many credits/gold a creature is worth if the player wins. Now that it does that except it doesn't update the database for the player with a new number of credits/gold.

 

$update1=$creature3['credits']/1;


if($atk1>$atk2)
{
echo "<center>You Won! You gained: $update1 Gold,<br>";

$skill="update ac_users set credits=credits+'update1', numturns=numturns-'0' where playername='$player'";
mysql_query($skill);

 

Now thats the code. Could anyone point out what I've done wrong of help fix this issue?

update1 is how many credits the creature is worth and if you look at the skill query where it says update1 it doesn't do that. Any help would be great appreciated. Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/37805-solved-not-updating-database/
Share on other sites

Durrr oh my. I can't believe I missed that thank you for pointing such a small error out to me. Staring a coding look enough and you miss these things. A fresh part of eyes is always helpful. Thakn you again  ;D

 

Don't forget the mysql_error() thing. It's very useful when you have problems with your MySQL statements, however don't forget to take it out before you go live with it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.