This topic is locked

master relationships

4/22/2007 11:20:05 PM
PHPRunner General questions
F
franmb author

i have this problem:

i want to fix a master relationship between 2 tables:

CREATE TABLE `orders` (

`OrderID` int(11) NOT NULL auto_increment,

`OrderDate` datetime default NULL,

PRIMARY KEY (`OrderID`)

) ;

CREATE TABLE `orders details` (

`OrderID` int(11) NOT NULL auto_increment,

`OrderDate` datetime default NULL,

`RequiredDate` datetime default NULL,

PRIMARY KEY (`OrderID`)

) ;

i select orders table as a master and the field OrderID

then at details table it doesn´t appear the field OrderID of order details

it happens with a lot of tables, where's the problem

thanks a lot

V
Vladimir 4/23/2007

Hi,
uncheck auto-increment checkbox for 'OrderID' field in details table in the database directly. Use one of the MySQL Administrative tools, for example phpMyAdmin.

kujox 4/23/2007

fran
you may need to change the layout of your tables slightly, this is how I lay them out
on the master table if you have OrderID, OrderDate
on the detail table you need OrderID, OrderDate, RequiredDate, MasterOrderID
then you highligh the the table you want as detail, in the master box, choose your master table and choose OrderID as the primary key
in the detail box choose MasterOrderID as the foreign key
hope this helps