This topic is locked
[SOLVED]

 Update Master Record

10/29/2012 12:24:02 PM
PHPRunner General questions
N
nuggie author

I have a Master Detail configuration as follows:
master table purchase_order

detail table purchase_order_detail
linked by purchase_order field rid = pid purchase_order_detail
purchase_order field rid is auto-incremented
I am trying to create a PO Number when a new record is added. I believe I am not correctly defining my event to work with the master-detail record.
My event is failing to create and update the po_number field.
Event purchase_order > Add page > After record added
// Create PO Number

$strUpdate = "update purchase_order set po_number='NU-".$formatted_value = sprintf("%04d", $values["rid"])."'where rid=".$keys["rid"]."";

CustomQuery($strUpdate);
Thanks for any help!
~n

Sergey Kornilov admin 10/29/2012

Instead of executing this query try to print it on the web page to see if there are any syntax errors.

$strUpdate = "update purchase_order set po_number='NU-".$formatted_value = sprintf("%04d", $values["rid"])."'where rid=".$keys["rid"]."";

//CustomQuery($strUpdate);

echo $strUpdate;

exit();


You can also run this query against your database manually to get more detailed error message.

N
nuggie author 10/29/2012

I do not know how to "Instead of executing this query try to print it on the web page to see if there are any syntax errors."
~n

Sergey Kornilov admin 10/29/2012

That's why I posted a code sample you need to use.

N
nuggie author 10/29/2012

Update - The event code works fine when I have the purchase_order table alone (no master detail). So this is highly likely related to the master-detail configuration.
Thanks again for any help in resolving.
~n

N
nuggie author 10/29/2012

Sorry Sergey, I thought that was my original event quoted, I know see the changes.
I replaced my event code with the code you provided.
I added a record. There was no message printed to the web page and there was no data written to the po_number field.
The problem persists.
PHPRunner 6.2 Build 13575
Thanks

~n

Sergey Kornilov admin 10/29/2012

If no query printed - some error happens even before this code is executed.
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. We also need to know how to reproduce this error.

C
cgphp 10/29/2012

Add a space between the single quote and the where word. Use keys array for keys not values. Try this version:

$strUpdate = "update purchase_order set po_number='NU-".$formatted_value = sprintf("%04d", $keys["rid"])."' where rid=".$keys["rid"];

CustomQuery($strUpdate);
N
nuggie author 10/30/2012

Hi Cristian!
Thank you for the assistance. I tried your version and it did not work. I am wondering if this is there is a bug in new PHPRunner 6.2.
Thanks again for the help!
Appreciated

~n

N
nuggie author 11/2/2012

Not sure how I marked this as solved but is not solved and continues to be an issue without resolution.

Sergey Kornilov admin 11/2/2012

Here is solution:

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. We also need to know how to reproduce this error.