Link as passed data in after_update

QuestionsLink as passed data in after_update
Pedro Couto asked 12 months ago

Good Afternoon Abu.

I´m sorry, i´m a bomber this days for a new aplication development.

as seen before, when i use the custom event “on_after_update”, i get some cells content a seen :

function after_update($data){
      global  $g;
      $Terminal = $data[“Terminal”];
      $PPD=  $data[“params”][“PrecioPorDosis”];
      $Bonos =  $data[“params”][“Bonos”];
      $Establecimiento = $data[“params”][“Establecimiento”];
      $PrevData = ‘[{“PPD”: ‘.$PPD.’,”Bonos”: ‘.$Bonos.’, “Est”: “‘.$Establecimiento.'”}]’;
      $Sql = “UPDATE datos SET PrevData = ‘$PrevData’ where Terminal = ‘$Terminal'”;
      $result = $g->execute_query($Sql);

}
the problem is that the field terminal defined as this :

            $col = array();
            $col[“title”] = “Terminal”;
            $col[“name”] = “Terminal”;
            $col[“width”] = “15”;
            $col[“hidden”] = false;
            $col[“show”] = array(“list”=>true, “add”=>true, “edit”=>true, “view”=>true, “bulkedit”=>false);
            $col[“link”] = “index2.php?terminal={Terminal}”;
            $col[“editrules”][“readonly”] = true;
            $cols[] = $col;

the problem es that when i capture the data i obtain this :
<a href=’index2.php?terminal=80001’>80001</a>

instead the contain 8001

any solution ?

best regards.

3 Answers
Abu Ghufran Staff answered 12 months ago

Hi,

In callback after_update, You can put:

$Terminal = strip_tags($data[“Terminal”]);
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Pedro Couto answered 12 months ago

Right, i have to learn more php.
Thanks a lot for your support.

Pedro Couto answered 12 months ago

Sorry to bother you again.

A new problem appears with this, Terminal is the first column in the row, so it´s the index and i get this error after update:

Couldn’t execute query. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘index2.php?terminal=141002′>141002′)’ at line 1 – UPDATE datos SET `Establecimiento`=’Bar Kyuco ‘,`Email`=”,`Telefono`=”,`PrecioPorDosis`=’0.18′,`Bonos`=’60’,`PrevData`='[{\”PPD\”: 0.18,\”Bonos\”: 60, \”Est\”: \”Bar Kyuco 3\”}]’ WHERE `Terminal` IN (‘141002‘)

 

 

Your Answer

6 + 16 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?