Alright... I have been fighting with this for days and I can't take it anymore...
Can anyone tell me why this works:
function sync_to_bitcoin($uid)
{
$bitcoin = connect_bitcoin();
$balance = $bitcoin->getbalance($uid, 6);
$query = "
UPDATE purses
SET amount = amount + '$balance'
WHERE uid='$uid' AND type='BTC';
";
do_query($query);
if (gmp_cmp($balance, '0') > 0) {
$bitcoin->move($uid, '', $balance);
$query = "
INSERT INTO requests (req_type, uid, amount, curr_type)
VALUES ('DEPOS', '$uid', '$balance', 'BTC');
";
do_query($query);
}
}
But this:
function sync_to_litecoin($uid)
{
$litecoin = connect_litecoin();
$balance = $litecoin->getbalance($uid, 6);
$query = "
UPDATE purses
SET amount = amount + '$balance'
WHERE uid='$uid' AND type='LTC';
";
do_query($query);
if (gmp_cmp($balance, '0') > 0) {
$litecoin->move($uid, '', $balance);
$query = "
INSERT INTO requests (req_type, uid, amount, curr_type)
VALUES ('DEPOS', '$uid', '$balance', 'LTC');
";
do_query($query);
}
}
is returning:
Warning: gmp_cmp(): Unable to convert variable to GMP
I am trying to use them in-line as:
[code]function sync_to_bitcoin($uid)
{
$bitcoin = connect_bitcoin();
$balance = $bitcoin->getbalance($uid, 6);
$query = "
UPDATE purses
SET amount = amount + '$balance'
WHERE uid='$uid' AND type='BTC';
";
do_query($query);
if (gmp_cmp($balance, '0') > 0) {
$bitcoin->move($uid, '', $balance);
$query = "
INSERT INTO requests (req_type, uid, amount, curr_type)
VALUES ('DEPOS', '$uid', '$balance', 'BTC');
";
do_query($query);
}
}
function sync_to_litecoin($uid)
{
$litecoin = connect_litecoin();
$balance = $litecoin->getbalance($uid, 6);
$query = "
UPDATE purses
SET amount = amount + '$balance'
WHERE uid='$uid' AND type='LTC';
";
do_query($query);
if (gmp_cmp($balance, '0') > 0) {
$litecoin->move($uid, '', $balance);
$query = "
INSERT INTO requests (req_type, uid, amount, curr_type)
VALUES ('DEPOS', '$uid', '$balance', 'LTC');
";
do_query($query);
}
}
Any help is greatly appreciated...[/code]