This topic is locked
[SOLVED]

 Button Not Working In Phpr 6.2, But Worked In Phpr 6.1

2/19/2013 12:58:05 PM
PHPRunner General questions
C
copper21 author

Hello,
I have this "Server" tab script on a button I created on the list page and worked well in PHPR 6.1. I see that when I create a button in PHPR 6.2 "$keys" are no longer available. How do I use "getCurrentRecord()" to get my key or other values.
//Like button

global $conn;
$strSQLExists = "SELECT ir, ps FROM case_analysis_person_ir_link WHERE ps = ".$_SESSION["UserID"]." AND ir = ".$keys["DR"]." AND person_like = 1";

$rsExists = db_query($strSQLExists,$conn);

$data=db_fetch_array($rsExists);
$strSQLExists = "SELECT ir, ps FROM case_analysis_person_ir_link WHERE ps = ".$_SESSION["UserID"]." AND ir = ".$keys["DR"]." AND person_like = 0";

$rsExists = db_query($strSQLExists,$conn);

$data1=db_fetch_array($rsExists);
if($data)

{

$result['txt'] = "You already LIKE This!";

}

else if($data1)

{

global $dal;
if($keys['DR'])

{

$tblEvents = $dal->Table("case_analysis_person_ir_link");
$tblEvents->Param["ir"]=$keys["DR"];
$tblEvents->Value["person_like"]=1;
$tblEvents->Update();
$result["txt"] = "You now RE-LIKE this IR!";

}}

else

{

global $dal;
if($keys['DR'])

{

$tblEvents = $dal->Table("case_analysis_person_ir_link");
$tblEvents->Value["ir"]=$keys["DR"];
$tblEvents->Value["ps"]=$_SESSION["UserID"];
$tblEvents->Value["person_like"]=1;
$tblEvents->Add();
$result["txt"] = "You now LIKE this IR!";

}}
Thanks for your help,
Brian

Sergey Kornilov admin 2/19/2013

$keys array is still available. See examples 1, 2 and 3 at http://xlinesoft.com/phprunner/docs/inserting_button.htm

C
copper21 author 2/19/2013

Thank you for the quick response.
I tried that exact code and got an error. I get the error "Exception thrown and not caught" in internet explorer. I then used Firefox and firebug and got the error "throw new SyntaxError('JSON.parse');};}}()); function set_cookie(name,value,expires,path,domain, secure)"
I am really just updating the old project in 6.2 with no difference in the tables I use. The only real big difference between the old project and the new one is that I expanded the datagrid using this post: http://www.asprunner.com/forums/topic/20410-moving-fields-in-visual-editor/ . I get all of the data within the datagrid I created on the list page.
Any further suggestions?
Thanks again,
Brian

Sergey Kornilov admin 2/19/2013

Brian,
my suggestion is to follow the advise in this article to find the actual error message:

http://xlinesoft.com/blog/2012/05/16/troubleshooting-custom-buttons-in-phprunner-and-asprunnerpro-applications/
This way you can quickly find what is wrong with the code.

C
copper21 author 2/19/2013

Sergey,
Thanks. After a bit of testing, I found that, in my case, I could only add a button on the row of where the original list data was. I could not add a button anywhere else in the grid, although I did move "{end grid_record}". I adjusted my design for the buttons to work in that row.
Thanks,
Brian