Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> powiązanie dwóch tabel
peklo
post
Post #1





Grupa: Zarejestrowani
Postów: 420
Pomógł: 0
Dołączył: 27.07.2011

Ostrzeżenie: (10%)
X----


Witam
mam dwie tabela

create table zlecenia (
id integer unsigned not null auto_increment,
nr varchar (10),
tresc text,
wykona varchar(30),
date datetime,
primary key (id)
) TYPE= MYISAM;

create table historia (
nr integer unsigned not null auto_increment,
id integer unsigned not null,
tresc text,
opis text,
date datetime,
primary key (nr)
)TYPE= MYISAM;

chciałbym je ze soba powiązać kluczem id w ten sposób ze gdy w tabeli zlecenia wykasuje np rekord 1 to automatycznie wykasuje mi sie caly rekord 1 w tabeli historia.
siedze juz nad tym kilka godzin i za cholere nie wiem jak to zrobic. Prosze o pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
wookieb
post
Post #2





Grupa: Moderatorzy
Postów: 8 989
Pomógł: 1550
Dołączył: 8.08.2008
Skąd: Słupsk/Gdańsk




http://dev.mysql.com/doc/refman/5.5/en/inn...onstraints.html
I po drugie tabele muszą być InnoDB a nie MyIsam.

Proszę wstawić bbcode.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 7.10.2025 - 02:21