Jump to content

[SOLVED] adding to mysql depending on field level


onyxblack

Recommended Posts

ok... well, seems like theres a few of us on this forum that are working on making a text based game...

 

Anywho.. my problem I want to be able to "add" to someones gold depending on their income level. I have a program that will run this page on a local folder every hour. The problem is - this script just dosn't work. I think it has to do with $getgold is returning more then 1 line and update gold is only attempting to update 1 line, though it dosn't appear to be effecting anything... I've gotten fairly far on my site, check it out http://bladefight.net

 

<?php
include('./../ix.conf.php');
mysql_connect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS);
mysql_select_db(MYSQL_DB);

$getgold = mysql_query("select `account`, `gold`, `incomelevel` FROM player_army WHERE gold>1");
$fetchgold = mysql_fetch_array( $getgold );
$income = ($fetchgold["incomelevel"]*2);

$addgold = $income+$fetchgold["gold"];
$Updategold = mysql_query("update `player_army` SET `gold`=$addgold WHERE (`account`='".$fetchgold["account"]."'");

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.