1

i use this script in mysql triger after insert on tbl_produk

FOR EACH ROW BEGIN
DECLARE cmd CHAR(255);
DECLARE result INT(100);
SET cmd=CONCAT('/usr/bin/php ', 'http://localhost/triger/add_post.php?produk=', NEW.produk, '&jumlah=', NEW.jumlah);
SET result = sys_exec(cmd);
END;

reference from https://dba.stackexchange.com/questions/39598/update-sql-server-from-mysql

but not runing, i hope an solution for this

1 Answer 1

1

If columns should be numeric than to convert varchar.

SET cmd=CONCAT('/usr/bin/php ', 'http://localhost/triger/add_post.php?produk=',convert(varchar(50),NEW.produk), '&jumlah=', convert(varchar(50),NEW.jumlah));
Sign up to request clarification or add additional context in comments.

4 Comments

thanks this work for insert into tbl_produk, but not update to tbl_trigger_produk,
@RikyCloud Not say thanks but given right marks and vot
i get error in sqlyog when add code "convert" like this Error Code: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(50),NEW.produk), '&jumlah=', CONVERT(VARCHAR(50),NEW.jumlah)); SET resu' at line 8
i think this problem is sys_exec function not exist, how to add lib_mysqludf_sys in mysql? 3hour i search this problem but not runing :D, can you help plis

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.