php - Trigger MSQL big issue, sql not working? -


i trying build trigger, problems is not working. have syntax problems. need build trigger update table record in same table before table has been been updated. trigger below describes want not work.

$deletequery = '          delimiter //          create trigger after_insert_job_sent         after insert            on envato_customconfig_job_sent each row          begin            delete `envato_customconfig_job_queue`            job_id = '.$value['job_id'].'           , email -'.$value['email'].';            update `envato_customconfig_job_status` set `email_sent_count`= email_sent_count+1            job_id = '.$value['job_id'].'                      end; //          delimiter;          insert envato_customconfig_job_sent         values ( null , '.$value['job_id'].', '.$value['email'].', now();             '; 

edit:

why query append other records aswell?.... working on update add 1 last record db. have tried limit did not work. ideas.

insert envato_customconfig_job_sent values ( null , '37', 'email', now());  delete envato_customconfig_job_queue job_id = '37' , email ='email';  update envato_customconfig_job_status set `email_sent_count`= email_sent_count+1  job_id = '37';         

triggers, events, functions, , stored procedures reside code stored in particular database. of them have parameter passing (such functions , stored procedures). others fire own (events , triggers).

what attempting perform delete php variable information query.

at least have delimiter concept nailed down, stands in way trivial error catches many people. if have highlighted trigger block, have seen syntax error highlighting, likely, around embedded where job_id = '.$value['job_id'].' chunk. , since trigger runs on triggered events such insert, etc, have no clue chunk.

when highlighted, mean in program such mysql workbench.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -