Hook setup

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
gonzalo
Posts: 14
Joined: 2015-08-24 14:42

Hook setup

Post by gonzalo » 2015-09-02 21:50

I am new to both PHP and Mysql. I set up my tables in Appgini and came up with UPDATE statements that do what I need done in my tables (checked each one in PHPMYADMIN). I inserted the update statements in the Hooks files and when I try to go in the tables nothing happens. I know I am missing something - but what? I am just inserting update statements in the after insert, after update and after delete sections of the table hook file.

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: Hook setup

Post by a.gneady » 2015-09-03 22:43

Would you post the hooks code you added please?
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

gonzalo
Posts: 14
Joined: 2015-08-24 14:42

Re: Hook setup

Post by gonzalo » 2015-09-09 20:28

I came up with a series of update commands to update the status of the tools in the master database. One such update is:

update equip
join eqjob on equip.eqlkl = eqjob.job
set equip.stat = "Available"
where eqjob.home="Y" ;



It does what I need, but within Phpmyadmin. I haven't been able to figure out where and how in the Hooks files I need to insert the code. I have been successful in adding this code as a trigger, but the trigger mechanism is severely limited as to the number of updates you can do to a table (namely 1).

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: Hook setup

Post by a.gneady » 2015-09-10 19:21

Hmm ... you need to pass your update query inside a call to sql() if you are placing it in the after_insert and/or after_update hooks:

Code: Select all

sql('your update query goes here', $eo);
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply