This topic is locked
[SOLVED]

 Insert Button On List Page : Server Issues On Numbers

2/9/2013 3:45:06 AM
PHPRunner General questions
R
rockrockers23 author

I once having problem dealing with number on Server events on Custom button but manage to make any number Value to String (using ''). But I get problem dealing with float/Double Type attributes.
I usually do this to fix the Sql problem(Insert, Update or Delete):

foreach($keys as $idx=>$val)

{

$sql = "Update transaction Set Order_ID= '" . $val["Generated_ID"] . "' where Reference_Code = '" . $val["Reference_Code"] . "'";

CustomQuery($sql);

}



If you notice, the Order_ID is set to String ('$val["Generated_ID"]') with single quotes. That fixes my problem. Success. But:

When trying to update customer balance, my fixing trick won't work anymore:

foreach($keys as $idx=>$val)

{

$sql = "Update Customer Set Balance = Balance + '" . $val["Amount"] . "' where Customer_ID = '" . $val["Customer_ID"] . "'";

CustomQuery($sql);

}


The above query doesn't update my customer Balance and have no errors. If I will NOT use the singles quotes ('" . $val["Amount"] . "') it then throw exception JSON.parse
I even tried floatval($val["Amount"]) but still won't update.

Sergey Kornilov admin 2/9/2013

You do not need to add quotes around numeric values like Amount.
My suggestion is to print those SQL queries on the web page to see what exactly might be wrong. Here is the article that can help you with this:

http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/
Check 'Additional troubleshooting tips' section.

R
rockrockers23 author 2/11/2013

Thanks, got it. Most of the issues comes from copied and pasted code from other event codes. I don't know if this is a bug.. but handler sees it sometimes as

select * from --rbegin--AnyTable--rend-- where --rbegin--SomeColumn--rend--='--rbegin--SomeValue--rend--'"


--rbegin-- and --rend--
thanks anyway