Hello:
The script below works fine when I call it in another function.
I am using ToyShopLinks_Credit_Center(); to call the function.
Now here is the weird part - when I call the function a second time I get the exact same result - even though the money count has changed.
I am guessing that somehow it's not reading again or some variable is not reset.
Anybody have a idea how to fix this?
Wiz
function ToyShopLinks_Credit_Center()
{
global $context, $smcFunc, $txt;
loadTemplate('ToyShopUser');
loadLanguage('toy shop languages/ToyShop', 'english');
$pocket = 0;
$atm = 0;
$result = $smcFunc['db_query']('', "
SELECT money, moneyBank
FROM {db_prefix}members
WHERE id_member = {int:id}
LIMIT 1", array(
'id' => $context['user']['id']
));
$row = $smcFunc['db_fetch_assoc']($result);
$smcFunc['db_free_result']($result);
$pocket = formatMoney($row['money']);
$atm = formatMoney($row['moneyBank']);
$context['toy_shop_credit_center'] = sprintf($txt['toy_shop_currently_have1'], $pocket, $atm);
}
At what stage are you expecting it to yield a different result the second time you run it?
I am seeing a query into a database for some data, but I don't see anywhere that is updating anything in the database?
Hello:
if you want to see the entire code go here
http://www.simplemachines.org/community/index.php?topic=517744.msg3668099#new
and download the latest version.
I was hoping to see if I missed anything simple. I tend to miss the really obvious stuff.
Thanks
Wiz
As far as I see it, you call that function in pretty much every function. Kind of an initialization, right?
I don't see why you expect different values, unless a user had changed values between page loads. In each page load that function should be called only once so...
Check the database values via phpmyadmin and compare them to the returned values.
If you want to be sure, try to echo/print_r some values while it is being processed.
Hello:
I finally solved this issue - it turned out is was a catching issue on the browser side, and so the results were messed up.
Thank you I really appreciate all the help and support. I don't think I would have gotten as far as I have without you and everybody else who has helped me. Again Thank you everybody.
Wiz