C
|
cgphp 11/6/2013 |
Put the code in the "After record updated", in the "Before record updated" the Part_ID value doesn't exist because the record hasn't been created yet. |
![]() |
Sergey Kornilov admin 11/6/2013 |
What Cristian says plus instead of $values["Part_ID"] you need to use $keys["Part_ID"] (assuming that Part_ID is a key column). |
W
|
wijninga author 11/6/2013 |
I'm afraid that doesn't help. If I remove the code from 'Before Record updated' and just add the code to 'After Record updated', I get the error message '<<< Record was NOT edited >>> Unknown column 'StockLocation' in 'field list'. |
W
|
wijninga author 11/6/2013 |
What Cristian says plus instead of $values["Part_ID"] you need to use $keys["Part_ID"] (assuming that Part_ID is a key column).
|
![]() |
Sergey Kornilov admin 11/6/2013 |
I see what you saying. If Part_ID is not a key column it makes sense moving code back to BeforeEdit event. |
W
|
wijninga author 11/6/2013 |
I see what you saying. If Part_ID is not a key column it makes sense moving code back to BeforeEdit event. It's hard to tell what might be wrong though. I would suggest switching from DAL-based updated to plain SQL and printing SQL query on the page can help you with troubleshooting.
|
![]() |
Sergey Kornilov admin 11/6/2013 |
Yes, you can use all the same variables i.e. $sql = "Update Stock set StockLocation = '".$values["StockLocation"] . "' where Part_ID = " . $values["Part_ID"];
$sql = "Update Stock set StockLocation = '".$values["StockLocation"] . "' where Part_ID = " . $values["Part_ID"];
|
W
|
wijninga author 11/7/2013 |
Yes, you can use all the same variables i.e. $sql = "Update Stock set StockLocation = '".$values["StockLocation"] . "' where Part_ID = " . $values["Part_ID"];
$sql = "Update Stock set StockLocation = '".$values["StockLocation"] . "' where Part_ID = " . $values["Part_ID"];
|
![]() |
Sergey Kornilov admin 11/7/2013 |
The value of $values["Part_ID"] is read from your Add or Edit form. |
W
|
wijninga author 11/8/2013 |
The value of $values["Part_ID"] is read from your Add or Edit form.
$sql = "Update Stock set Amount = '".$values["Amount"] . "' where Part_ID = " . $keys["Part_ID"]; |
![]() |
Sergey Kornilov admin 11/8/2013 |
exit(); statement terminates page execution. Remove it. |
W
|
wijninga author 11/8/2013 |
exit(); statement terminates page execution. Remove it.
|
![]() |
Sergey Kornilov admin 11/8/2013 |
Make sure you didn't remove the following line of code from your BeforeAdd or BeforeEdit event: unset($values["StockLocation"]); |
W
|
wijninga author 11/9/2013 |
Make sure you didn't remove the following line of code from your BeforeAdd or BeforeEdit event: unset($values["StockLocation"]);
|