Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
-
antubis
- Forum Newbie
- Posts: 16
- Joined: Sun Apr 30, 2006 1:48 pm
- Location: Pavlikeni, Bulgaria
-
Contact:
Post
by antubis »
Hello to all,
I want to link two tables so when I insert information in first table ( when I create row ), a new row is creating in other table.
10x and Regards to all
-
savant
- Forum Newbie
- Posts: 10
- Joined: Mon May 01, 2006 7:56 am
Post
by savant »
-
BadgerC82
- Forum Commoner
- Posts: 25
- Joined: Tue Feb 07, 2006 6:53 am
Post
by BadgerC82 »
I'm not sure it was the article you are after that was posted by savant.
Essentially are you wanting to create a row on a table within the same database? If so why not just use another insert?
Carl
-
GM
- Forum Contributor
- Posts: 365
- Joined: Wed Apr 26, 2006 4:19 am
- Location: Italy
Post
by GM »
antubis wrote:Hello to all,
I want to link two tables so when I insert information in first table ( when I create row ), a new row is creating in other table.
10x and Regards to all
You need to create a trigger, like:
Code: Select all
CREATE TRIGGER trigger_name AFTER INSERT ON table1
FOR EACH ROW BEGIN
INSERT INTO table2 VALUES (values);
END