This topic is locked

CustomQuery and Button events

4/22/2012 3:40:16 PM
PHPRunner General questions
R
Roberto author

Hi,

I'm having a small issue with the subject of this topic.
In a list page I added a button to start the duplication of the selected records.
What happens is that the 1st selected element of the list get duplicated, but then the execution of the code stops, the page of course doesn't get updated and all the elements are still selected.

I wasn't able to identify the problem, becasue I'm not very familiar with PHP code or javascript and I'd like to know if there is a way of tracing what happens when the CustomQuery gets executed at this control.

If I replace CustomQuery($sql); with $result["txt"] = $result["txt"] . $sql; the process passes from the Server to the Client After event without ane issue.

So it seems the the first occurence of CustomQuery gets executed (the DB gets updated with the duplicated record) and then no more.
At the end of the post is the Button's properties code.
As plus I'd like to show the process to the user.

I didn't look much into it, but any suggestion will greatly appreciated.
Thank you

Roberto.
--------
Event: Client Before



if (!confirm("Are you sure you want to Re-Issue the selected records?")) {

ctrl.setEnabled();

return;

}


Event: Server



global $dal;

for ($i=0; $i<count($keys); $i++) {

$str = "

CREATE TEMPORARY TABLE tmp01 SELECT * FROM cert_clbrs WHERE Cert_ID = '".$keys[$i]["Cert_ID"]."';

UPDATE tmp01 SET Cert_ID = NULL, Cert_No = CONCAT(Cert_No,'/REISSUE'), Cert_Date = NULL;

INSERT INTO cert_clbrs SELECT * FROM tmp01;

DROP TABLE tmp01;

";

$query = explode(";", $str);

foreach ($query as $index => $sql) {

CustomQuery($sql);

//$result["txt"] = $result["txt"] . $sql;

};

};
$result["txt"] = "Certs were Re-Issued.";


Event: ClientAfter



var message = result["txt"];

alert(message);

location.href = "cert_clbrs_list.php";
Sergey Kornilov admin 4/22/2012

I guess some sort of error happens in your PHP code and this is why ClientAfter event is not executed.
If you need more help with this post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

R
Roberto author 4/29/2012

Hi Admin
I uploaded the application to the demo account.
Does the CustomQuery function return an error message if it fails?

And how can I stop the execution at that point?
Thank you,

Roberto



I guess some sort of error happens in your PHP code and this is why ClientAfter event is not executed.
If you need more help with this post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

Sergey Kornilov admin 4/29/2012

Roberto,
you need to open a ticket sending your application URL. We do not know which one is your application there.
It all depends on what sort of error you getting. For example if this is a syntax error in your code you won't be able to catch it.