Hallo NG,
ich versuche gerade ein PHP-Script zu bauen, das einen Trigger in einer
MySQL-Datenbank erstellt.
Doch leider funktioniert das nicht und ich habe auch über google keine
Hinweise gefunden. Ich vermute, dass es am Delimiter liegt.
Der Code, der per PHP abgeschickt wird:
DELIMITER |
CREATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON anbieter
FOR EACH ROW BEGIN
DELETE FROM ext4cSupportfor m WHERE anbieter = OLD.anbieter;
END;
|
DELIMITER ;
Die Syntax ist laut MySQL-Doku [1] korrekt. Im phpMyAdmin wird der Code
(ohne die DELIMITER-Statements, aber mit Angabe dessen im entsprechenden
Feld) auch angenommen.
Versionen:
PHP 5.2
MySQL 5.0.32
Weiß jemand Rat?
Danke!
Gruß...Sven.
[1] http://dev.mysql.com/doc/refman/5.1/...e-trigger.html
-- http://www.sReuter.net/ http://www.Auskennbert.de/ 11 3107
"Jensen Somers" <je****@sig.see .invalidschrieb im Newsbeitrag
news:O9******** *************** *******@giganew s.com...
Sven Reuter wrote:
<snip>
This is an English newsgroup, please post your question in English or
in
a newsgroup that targets your language.
Sorry for that. I worked all the day so that I didn't realized that :-(
Here an english version of my post:
I try to write a PHP script that should create a trigger in a MySQL
database.
But it don't work and I don't found hints at google. I assume a problem
with the DELIMITER.
Here's the Code sent by the PHP script:
DELIMITER |
CREATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON anbieter
FOR EACH ROW BEGIN
DELETE FROM ext4cSupportfor m WHERE anbieter = OLD.anbieter;
END;
|
DELIMITER ;
The syntax correct according to MySQL-Doc [1]. In phpMyAdmin the code is
executed well (without DELIMITER statements but with delimiter
expression in the analogical form field).
versions:
PHP 5.2
MySQL 5.0.32
Can anyone help?
Thx!
Bye...Sven.
[1] http://dev.mysql.com/doc/refman/5.1/...e-trigger.html
-- http://www.sReuter.net/ http://www.Auskennbert.de/
Sven Reuter wrote:
Hallo NG,
ich versuche gerade ein PHP-Script zu bauen, das einen Trigger in einer
MySQL-Datenbank erstellt.
Doch leider funktioniert das nicht und ich habe auch über google keine
Hinweise gefunden. Ich vermute, dass es am Delimiter liegt.
Der Code, der per PHP abgeschickt wird:
DELIMITER |
CREATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON anbieter
FOR EACH ROW BEGIN
DELETE FROM ext4cSupportfor m WHERE anbieter = OLD.anbieter;
END;
|
DELIMITER ;
Die Syntax ist laut MySQL-Doku [1] korrekt. Im phpMyAdmin wird der Code
(ohne die DELIMITER-Statements, aber mit Angabe dessen im entsprechenden
Feld) auch angenommen.
Versionen:
PHP 5.2
MySQL 5.0.32
Weiß jemand Rat?
Danke!
Gruß...Sven.
[1] http://dev.mysql.com/doc/refman/5.1/...e-trigger.html
This is an English newsgroup, and it's for PHP - not MySQL. Please ask
in a German MySQL newsgroup.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Jerry Stuckle wrote:
This is an English newsgroup, and it's for PHP - not MySQL. Please
ask in a German MySQL newsgroup.
I wrote my post in an english version again in reply to Jensens post.
I think it's not a problem of MySQL.
-- http://www.sReuter.net/ http://www.Auskennbert.de/
Jerry Stuckle wrote:
Sven Reuter wrote:
>Hallo NG,
ich versuche gerade ein PHP-Script zu bauen, das einen Trigger in einer MySQL-Datenbank erstellt.
Doch leider funktioniert das nicht und ich habe auch über google keine Hinweise gefunden. Ich vermute, dass es am Delimiter liegt.
Der Code, der per PHP abgeschickt wird:
DELIMITER | CREATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON anbieter FOR EACH ROW BEGIN DELETE FROM ext4cSupportfor m WHERE anbieter = OLD.anbieter; END; | DELIMITER ;
Die Syntax ist laut MySQL-Doku [1] korrekt. Im phpMyAdmin wird der Code (ohne die DELIMITER-Statements, aber mit Angabe dessen im entsprechend en Feld) auch angenommen.
Versionen: PHP 5.2 MySQL 5.0.32
Weiß jemand Rat?
Danke!
Gruß...Sven.
[1] http://dev.mysql.com/doc/refman/5.1/...e-trigger.html
This is an English newsgroup, and it's for PHP - not MySQL. Please ask
in a German MySQL newsgroup.
Is it?
By golly, and there was me thinking it was a worldwide group.
Sven Reuter wrote:
Jerry Stuckle wrote:
>This is an English newsgroup, and it's for PHP - not MySQL. Please ask in a German MySQL newsgroup.
I wrote my post in an english version again in reply to Jensens post.
I think it's not a problem of MySQL.
You aren't showing any PHP code, and only asking about SQL code.
comp.databases. mysql is the correct group to be asking in.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Jerry Stuckle wrote:
Sven Reuter wrote:
>Jerry Stuckle wrote:
>>This is an English newsgroup, and it's for PHP - not MySQL. Please ask in a German MySQL newsgroup. I wrote my post in an english version again in reply to Jensens post. I think it's not a problem of MySQL.
You aren't showing any PHP code, and only asking about SQL code.
comp.databases. mysql is the correct group to be asking in.
However the SQL code works, except when embedded into php..
Things to check.
- PHP user has sufficient privileges to access the database in this way:
the phpmyadmin program my not connect to the database as the same user.
- no hidden charcter replacement to the query string is being performed
my the php->mysql shim library.
turn on all error reporting a well.
The Natural Philosopher wrote:
Jerry Stuckle wrote:
>You aren't showing any PHP code, and only asking about SQL code.
comp.databases .mysql is the correct group to be asking in.
However the SQL code works, except when embedded into php..
Yes, that's right. I think I've found a solution for my problem:
Although MySQL requires DELIMITER statements it's not possible to use
them in PHP. I've just sent the statement for the trigger and it worked
(encapsulated in PHP code especially for Jerry ;-) ):
$result = mysql_query('CR EATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON
anbieter FOR EACH ROW BEGIN DELETE FROM ext4cSupportfor m WHERE anbieter
= OLD.anbieter; END;');
Bye...Sven.
-- http://www.sReuter.net/ http://www.Auskennbert.de/
Sven Reuter wrote:
The Natural Philosopher wrote:
>Jerry Stuckle wrote:
>>You aren't showing any PHP code, and only asking about SQL code.
comp.database s.mysql is the correct group to be asking in.
However the SQL code works, except when embedded into php..
Yes, that's right. I think I've found a solution for my problem:
Although MySQL requires DELIMITER statements it's not possible to use
them in PHP. I've just sent the statement for the trigger and it worked
(encapsulated in PHP code especially for Jerry ;-) ):
`Be kind to Jerry. He's really past it these days..
$result = mysql_query('CR EATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON
anbieter FOR EACH ROW BEGIN DELETE FROM ext4cSupportfor m WHERE anbieter
= OLD.anbieter; END;');
Ee Bai Gum kad, that were a strangling of t'English language.
Bye...Sven.
Sven Reuter wrote:
The Natural Philosopher wrote:
>Jerry Stuckle wrote:
>>You aren't showing any PHP code, and only asking about SQL code.
comp.database s.mysql is the correct group to be asking in.
However the SQL code works, except when embedded into php..
Yes, that's right. I think I've found a solution for my problem:
Although MySQL requires DELIMITER statements it's not possible to use
them in PHP. I've just sent the statement for the trigger and it worked
(encapsulated in PHP code especially for Jerry ;-) ):
$result = mysql_query('CR EATE TRIGGER ext4cAnbieter_d el AFTER DELETE ON
anbieter FOR EACH ROW BEGIN DELETE FROM ext4cSupportfor m WHERE anbieter
= OLD.anbieter; END;');
Bye...Sven.
Which is the answer you would have gotten very quickly had you asked in
the correct newsgroup.
This isn't a PHP issue - it's true when you create a trigger using ANY
language APIs. That includes C, Java and any other supported language,
not just PHP.
Here's a hint. PHP knows absolutely NOTHING about CREATE TRIGGER or
similar SQL statements. They're just strings to PHP - which are passed
on to MySQL for processing.
So maybe next time you'll ask in the correct newsgroup - and get an
answer.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== === This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hanjo Grüßner |
last post by:
Hello,
I'm not shure wether it's OT or not.
I want to use an eMail as a trigger to start a program.
E.g. an eMail-Group: any group-member sends an eMail to a group-e-adress
an the Mail is dispatches automatically to all members.
I know there are services like yahougroups who do exactly this, but I
|
by: kevin jin |
last post by:
Hi,
I did read Andrew's article about SQL Server trigger.
After a 'Insert' trigger is fired,is there any way we can modify newly
added data in virtual 'Insert' table before put them to the database?
Thanks!
Kevin Jin
|
by: Scott CM |
last post by:
I have a multi-part question regarding trigger performance. First of
all, is there performance gain from issuing the following within a
trigger:
SELECT PrimaryKeyColumn FROM INSERTED
opposed to:
SELECT * FROM INSERTED
|
by: JohnO |
last post by:
Thanks to Serge and MarkB for recent tips and suggestions.
Ive rolled together a few stored procedures to assist with creating
audit triggers automagically. Hope someone finds this as useful as I've
found it educational.
Note:
- I build this for use in a JDEdwards OneWorld environment. I'm not
sure how generic others find it but it should be fairly generic.
- I use a C stored procedure GETJOBNAME to get some extra audit data,
|
by: Karl O. Pinc |
last post by:
I'm sure I saw something like this on the postgresql web
site but the the search function is down in the documentation
area.
I'm unable to pass a function arguments in a CREATE
TRIGGER statement.
What am I doing wrong here?
CREATE FUNCTION pregs_func (VARCHAR(15))
| |
by: Justin Clift |
last post by:
Hi all,
I'm creating a centralised table to keep a log of changes in other tables.
In thinking about the PL/pgSQL trigger to write and attach to the
monitored tables (probably a row level AFTER trigger), I can see two
approaches:
a) Write a separate PL/pgSQL function for each table, with the hard
coded field names in the function.
|
by: Mike Nolan |
last post by:
I have a before insert trigger that updates a value in another table.
It appears that I cannot depend upon that update having taken place
in an after insert trigger on the first table. (The one with the insert.)
Is there a way to force this or do I need to look for a different idea
here?
--
Mike Nolan
|
by: Ots |
last post by:
I'm using SQL 2000, which is integrated with a VB.NET 2003 app.
I have an Audit trigger that logs changes to tables. I want to apply
this trigger to many different tables. It's the same trigger, with the
exception of the table name. I could manually change the table name in
the trigger and create it, over and over, but I'd like to automate
this - by iterating through the collection of tables and passing the
tablename to something that...
|
by: lalala |
last post by:
hi ppl... i am totally new to this stuff and i need to create a trigger before an update operation is occured when it matched the date in the database and i got a sample of trigger from the internet... where should i put this trigger inside <?php ???
CREATE TRIGGER updtrigger BEFORE UPDATE ON tenaga
FOR EACH ROW
BEGIN
IF NEW.EffectiveDate = date THEN
SET NEW.Salary=10000;
ELSEIF NEW.Salary>500 THEN
SET NEW.Salary=15000;
|
by: watusiboy |
last post by:
is it possible to trigger a java class stored in my local server through php?
thanks
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |