payb.tc
|
|
February 14, 2013, 03:41:28 AM |
|
Aah, the joys of PHP and echo'ing SQL statements carefully crafted by hand yeah these days i'm more likely to be using codeigniter's $db->last_query() function after having it constructed for me
|
|
|
|
Herodes
|
|
February 14, 2013, 03:43:29 AM |
|
Not sure what kind of tools you use to develop, but I just set up vim with xdebug on my personal development machine, and it works wonders: https://bitcointalk.org/index.php?topic=143923.0I had an issue where some queries to get the current bitcoin price didn't work. So the usual method would be to make echo statements, and see where things went wrong, but then I installed this, and now I can step into functions, and execute code line by line, yay. I found the error I was chasing immediately, instead of using 30 minutes with echo statements.
|
|
|
|
c4n10 (OP)
|
|
February 14, 2013, 03:48:08 AM |
|
Not sure what kind of tools you use to develop, but I just set up vim with xdebug on my personal development machine, and it works wonders: https://bitcointalk.org/index.php?topic=143923.0I had an issue where some queries to get the current bitcoin price didn't work. So the usual method would be to make echo statements, and see where things went wrong, but then I installed this, and now I can step into functions, and execute code line by line, yay. I found the error I was chasing immediately, instead of using 30 minutes with echo statements. I've never really used vim much, wasn't aware of the xdebug function, I always just code/edit in nano but sounds like vim might be worth taking a look at...
|
|
|
|
Herodes
|
|
February 14, 2013, 04:07:37 AM |
|
Not sure what kind of tools you use to develop, but I just set up vim with xdebug on my personal development machine, and it works wonders: https://bitcointalk.org/index.php?topic=143923.0I had an issue where some queries to get the current bitcoin price didn't work. So the usual method would be to make echo statements, and see where things went wrong, but then I installed this, and now I can step into functions, and execute code line by line, yay. I found the error I was chasing immediately, instead of using 30 minutes with echo statements. I've never really used vim much, wasn't aware of the xdebug function, I always just code/edit in nano but sounds like vim might be worth taking a look at... Vim has a very steep learning code, but you can do all kinds of awsome things with it, and that's not just for the showoff factor, but also for the practical factor. The cool thing is that there's no menus, no nothing on your screen, so people looking at you will think you're some kind of wizzard. Keeping a cheat sheet near the computer or on the computer is a nice thing. I am sure there's a lot of beginners guides. There's a lot of nice shortcuts that let you perform magic. You can do block editing, ie. vertical editing, you can make macros etc. and there exist a lot of plugins, with ctags you can even get autocomplete. So for the long run it rocks. Once you start mastering it, you will never go back.
|
|
|
|
payb.tc
|
|
February 14, 2013, 04:39:54 AM |
|
not that netbeans is perfect, but you can use xdebug in that no problem, you don't have to use vim
|
|
|
|
c4n10 (OP)
|
|
February 14, 2013, 07:08:18 AM |
|
Alright, I have this code: <?php require '../htdocs/config.php'; require '../util.php';
function update_req($reqid, $status) { $query = " UPDATE requests SET status='$status' WHERE reqid='$reqid' AND curr_type='RUC' "; do_query($query); }
$query = " SELECT requests.reqid AS reqid, uid, amount, addy FROM requests JOIN rucoin_requests ON requests.reqid=rucoin_requests.reqid WHERE req_type='WITHDR' AND amount > 0 AND status='VERIFY' AND curr_type='RUC' "; $result = do_query($query); $rucoin = connect_rucoin(); while ($row = mysql_fetch_assoc($result)) { $reqid = $row['reqid']; $uid = $row['uid']; $amount = $row['amount']; $addy = $row['addy'];
if ($rucoin->getbalance('') >= 0) { update_req($reqid, 'PROCES'); $rucoin->sendfrom('', $addy, $amount); update_req($reqid, 'FINAL'); } } ?> And it is working perfectly all the way up to: $rucoin->sendfrom('', $addy, $amount); I believe I have a syntax error being fed to the jsonRPCClient as I know the $addy and $amount are both returning correct values, I have tested issuing the command by hand to rucoind so I know it supports the "sendfrom" function and is accessible yet I am receiving an HTTP 500 error from rucoind. I am using the "$rucoin = connect_rucoin" function in various places to send calls to rucoind and retrieve information, all without error, but this last thing just does not seem to want to work. Anyone have any ideas...?
|
|
|
|
payb.tc
|
|
February 14, 2013, 09:35:04 AM |
|
Alright, I have this code: <?php require '../htdocs/config.php'; require '../util.php';
function update_req($reqid, $status) { $query = " UPDATE requests SET status='$status' WHERE reqid='$reqid' AND curr_type='RUC' "; do_query($query); }
$query = " SELECT requests.reqid AS reqid, uid, amount, addy FROM requests JOIN rucoin_requests ON requests.reqid=rucoin_requests.reqid WHERE req_type='WITHDR' AND amount > 0 AND status='VERIFY' AND curr_type='RUC' "; $result = do_query($query); $rucoin = connect_rucoin(); while ($row = mysql_fetch_assoc($result)) { $reqid = $row['reqid']; $uid = $row['uid']; $amount = $row['amount']; $addy = $row['addy'];
if ($rucoin->getbalance('') >= 0) { update_req($reqid, 'PROCES'); $rucoin->sendfrom('', $addy, $amount); update_req($reqid, 'FINAL'); } } ?> And it is working perfectly all the way up to: $rucoin->sendfrom('', $addy, $amount); I believe I have a syntax error being fed to the jsonRPCClient as I know the $addy and $amount are both returning correct values, I have tested issuing the command by hand to rucoind so I know it supports the "sendfrom" function and is accessible yet I am receiving an HTTP 500 error from rucoind. I am using the "$rucoin = connect_rucoin" function in various places to send calls to rucoind and retrieve information, all without error, but this last thing just does not seem to want to work. Anyone have any ideas...? PHP can sometimes do weird things with variable types... try this and get back to us: $rucoin->sendfrom('', $addy, (float) $amount);
|
|
|
|
c4n10 (OP)
|
|
February 14, 2013, 12:40:30 PM |
|
PHP can sometimes do weird things with variable types... try this and get back to us: $rucoin->sendfrom('', $addy, (float) $amount); Hmmm, I will have to give that a try sometime, was actually coming back to report that I got it working with: $rucoin->sendfrom('', $addy, (double)$amount);
|
|
|
|
payb.tc
|
|
February 14, 2013, 12:56:04 PM |
|
PHP can sometimes do weird things with variable types... try this and get back to us: $rucoin->sendfrom('', $addy, (float) $amount); Hmmm, I will have to give that a try sometime, was actually coming back to report that I got it working with: $rucoin->sendfrom('', $addy, (double)$amount); just as good
|
|
|
|
|