if ($action == "go") {
$query = "UPDATE pannello SET perc_start = 1 WHERE id = {$row['id']}";
if(ew_Execute($query)){
$this->setSuccessMessage("ID: {$row['id']} UPDATED WITH QUERY: $query");
return true;
}else{
$this->setFailureMessage("Failed to update record ID = {$row['id']}");
return false;
};
}
Called in page load by:$this->CustomActions[“go”] = new cListAction(“go”, “GO!”, true, EW_ACTION_AJAX, EW_ACTION_SINGLE, “Set row to go”, “glyphicon glyphicon-star ewIcon”);I ALWAYS get success message but ew_Execute doesn’t update my database at all.I echoed the generated query to test it in mysql and it works, so what may be the problem? (ps I see a person icon instead of the star icon…)I’m using PHPMAKER 2018.0.8Thanks a lot!
Ok I figured out the problem.I use to write server event code in a separare files and includes in phpmaker so I can edit it faster.
For example my row_customAction code in phpmaker is:// Row Custom Action event
function Row_CustomAction($action, $row) {include (‘…/include/mytable_ListOptions_CustomAction.php’);}And mytable_ListOptions_CustomAction.php has the needed code:if ($action == “go”) {
$query = “UPDATE pannello SET perc_start = 1 WHERE id = {$row[‘id’]}”;
if(ew_Execute($query)){
$this->setSuccessMessage(“ID: {$row[‘id’]} UPDATED WITH QUERY: $query”);
return true;
}else{
$this->setFailureMessage(“Failed to update record ID = {$row[‘id’]}”);
return false;
};
}Usually It works fine but not in this case, I dont know why but I’ve to copy/paste in phpmaker client/script all the contents of the included file instead of use include.Why including code-file does not work in this case?However I’ve solved working in “traditional” way inserting code in phpmaker instead of include code-file
Are you still using v2018 or this time you use v2020?
You should never write your PHP code again in external file and include
it in any server event.
You should write your code directly into the related server events
instead.
Yes I’m still using v2018 and for sure I’ll stop to include file fro now. However it was convenient because you can test your code without re-generate project every time…
Ok now all is working fine… but I cannot have the right icon!$this->CustomActions[“go”] = new cListAction(“go”, “GO!”, true, EW_ACTION_AJAX, EW_ACTION_SINGLE, “Set row to go”, “glyphicon glyphicon-star ewIcon”);With this code I get a ‘person’ icon, what is wrong? If I test the same code with EW_ACTION_MULTIPLE the icon star works…