Thanks Dan Harabagiu,

I used it in symfony and it is very useful . But some time i want to use
plain php. I don't know how to manage these foreign keys in plain php. do u
have any idea ?



On Thu, Jun 17, 2010 at 6:16 PM, Dan Harabagiu <[email protected]>wrote:

> Hi,
>
>   I am using foreign keys with propel, and it provides me ability to access
> the data with ease, without operating additional queries. Like
>
> $c = new Criteria();
> $c->add(DetailsPeer::ID,1);
> $details = DetailsPeer::doSelectOne($c);
> $details->getUsers()->getName(); //this would get the user name from
> details using FK
>
> Dan.
>
> On Thu, Jun 17, 2010 at 3:40 PM, Arun Raj R <[email protected]> wrote:
>
>> Dear Friends,
>>
>> Could you please tell me what are the advantages of setting foreign key in
>> database ?
>>
>>
>> I had created two tables
>>
>> users
>>    id
>>    name
>> details
>>    id
>>    address
>>    users_id (foreign key)
>>
>> Could you please tell me what are the advantages of using like this ?
>> and how to operate on this data ?
>>
>> Can i able to insert both table data into it with one query  ?
>>
>> If you have any info please share me
>>
>>
>> CREATE TABLE IF NOT EXISTS `details` (
>>   `id` int(11) NOT NULL auto_increment,
>>   `address` varchar(255) NOT NULL,
>>   `users_id` int(11) NOT NULL,
>>   PRIMARY KEY  (`id`),
>>   KEY `users_id` (`users_id`)
>> ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
>>
>>
>>
>> CREATE TABLE IF NOT EXISTS `users` (
>>   `id` int(11) NOT NULL auto_increment,
>>   `name` varchar(255) NOT NULL,
>>   PRIMARY KEY  (`id`)
>> ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
>>
>> Thanks in advance
>>
>> --
>> Arun Raj R
>>
>> Developer , OrisysIndia IT Enabled Services, Thiruvananthapuram
>> Corporate office : Bangalore
>> Phone : 0471-(40)-14325
>> Mobile : 919946014345
>> Blog : www.techaspirant.com
>> www.OrisysIndia.com
>> Linkedin: www.linkedin.com/in/arunrajr
>>
>> --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<symfony-users%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>  --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Arun Raj R

Developer , OrisysIndia IT Enabled Services, Thiruvananthapuram
Corporate office : Bangalore
Phone : 0471-(40)-14325
Mobile : 919946014345
Blog : www.techaspirant.com
www.OrisysIndia.com
Linkedin: www.linkedin.com/in/arunrajr

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to