Hi John,

"John Taylor-Johnston" <[EMAIL PROTECTED]> wrote in 
message news:[EMAIL PROTECTED]
> Does anyone know of a good MySQL group?
> I want to make a relational link from `data` to `shopping` so when I 
> insert a new record in `shopping`, I will see the contents of
> `data`.`name` and `data`.`email` as a drop-down menu in `shopping`.
>
> Where does one go to get this kind of help?
>
> Thanks,
> John
>
>
> DROP TABLE IF EXISTS `data`;
> CREATE TABLE `data` (
>   `id` int(5) NOT NULL auto_increment,
>   `name` varchar(255) NOT NULL,
>   `email` varchar(255) NOT NULL default '',
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
>
> INSERT INTO `data` VALUES(1, 'Allen, Carolyn', '[EMAIL PROTECTED]');
> INSERT INTO `data` VALUES(2, 'Atwood, Margaret', 
> '[EMAIL PROTECTED]');
>
> DROP TABLE IF EXISTS `shopping`;
> CREATE TABLE `shopping` (
>   `id` int(5) NOT NULL auto_increment,
>   `name` varchar(100) NOT NULL,
>   `address` varchar(100) NOT NULL,
>   `email` varchar(100) NOT NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
>
I'm not certain but think you need to include a 'references 
table_name(field_name)' clause that sets up the Foreign key relationship 
between the 2 tables. I think the Reference clause would replace the 
auto_increment in your primary key of the referencing table.

HTH
George 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to