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"]."'");

?>

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.