Friday, September 24, 2010

How can I populate data belonging to TWO NON-RELATED TABLES in ONE Controller

I am new to CakePHP and this is my first question in this group.
Would be greatly appreciate if you can able to help me out in the below question

How can I populate data belonging to TWO NON-RELATED TABLES in ONE Controller

Example:
I have two tables

Table 1. members (id, member_name, member_email)
Table 2. server_info(id, server_info, server_details)

Table 1 will contain data like
id, member_name, member_email
'1','Member 1 Name','member1@gmail.com'
'2','Member 2 Name','member2@gmail.com';
'3','Member 3 Name','member3@gmail.com';


Table 2 will contain data like
id, server_info, server_details
'1','Host','smtp.gmail.com'
'2','Port','465';
'3','Username','My User Name';
'4','Password','My password';
'5','from','myname@gmail.com';
'6','fromName','My Full Name';
'7','setReturnPath','myname@gmail.com';
'8','NotifyReceipt','myname@gmail.com';
'9','replyTo','myname@gmail.com';

Now I want to populate the data of both the tables in my Members controller.

Now Members table can be populated in Members controller as below.
$table = $this->Member->query("SELECT members.id, members.name,
members.email FROM members");

Now how can I populate server_info table in Members controller.

I want to send emails to the data in Members table using the SMTP
information available in server_info table.

Thanking you,
Yours sincerely
- Ancy

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: