-1

I am using phpmyadmin. I am using a trigger in mysql which calls a php script after inserting something in a table. But i cant create the trigger it shows an error msg..

#1064 sql syntax error

Help me with this... My code inside a trigger

DECLARE result INT;
SET result=select sys_exec('C:/xampp/php/php.exe C:/xampp/htdocs/mysite/hello.php');
1
  • Or bundle the PHP with a script that will execute it (e.g. by putting the PHP in the DATA section of a perl script and having the script pipe the data to a PHP interpreter). Although, to clarify, I'm providing that solution simply for variety; nl-x's solution makes more sense. Commented Jun 26, 2014 at 13:43

1 Answer 1

1

You should use something like select (This is why you get the syntax error.)

And you should use some executable what will run that PHP file. (EG PHP.EXE)

Try something like:

DECLARE result INT;    
SET result = (select sys_exec('C:/path/to/PHP.EXE C:/xampp/htdocs/mysite/hello.php'));
Sign up to request clarification or add additional context in comments.

6 Comments

may i know what is C:/path/to/PHP.EXE and where i can get this php.exe file.. I am a beginner plz help me... Thanks..
@user3496195 Did you try c:\xampp\php\php.exe ? Does that exist on your disk ?
yes php.exe is exists... but after altering my code as you suggest i got the same error... is there any other error in my code.. editted my code in my question too...
@user3496195 I think it is missing extra parens () . I have edited my answer
now the trigger was created but i cant insert any thing to the table it shows error as #1305 - FUNCTION db2.sys_exec does not exist
|

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.