0

I have an action like this:

updatecreditbyaction('updatecredit', $_GET['uid'], array('extcredits2' => '+'.$paycredit));

The updatecredit is action name.

The $_GET['uid'] is a user UID number.

The array('extcredits2' => '+'.$paycredit) is add the $paycredit amount to extcredits2.

My question is, I would like to use $extown to replace the extcredits2

I try the below coding,

$extown = "extcredits99";
updatecreditbyaction('updatecredit', $_GET['uid'], array($extown => '+'.$paycredit));

but when $extown inside the action, it was a blank value, not extcredits99 how to resolve it?

Thank you.

1 Answer 1

1

Try this:

$extown = array();
$extown['extcredits99'] = '+'.$paycredit;
updatecreditbyaction('updatecredit', $_GET['uid'], $extown);
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, but if the extcredits99 store at database, and I use $querySetting = mysql_query("SELECT * FROM game_tradewar_setting"); while($rowSetting = mysql fetch array($querySetting)) { $excredits = $rowSetting['excredits']; }; the $excredits is extcredits99, how do I replace $excredits into $extown['???'] Thanks
just don't use quotation mark.. like this $querySetting = mysql_query("SELECT * FROM game_tradewar_setting"); while($rowSetting = mysql fetch array($querySetting)) { $excredits = $rowSetting['excredits']; $extown = array(); $extown[$excredits] = '+'.$paycredit; updatecreditbyaction('updatecredit', $_GET['uid'], $extown); };

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.