Saving data in many tables in CakePHP
I a newbie question. This is how can I save data in many tables. Heres a scenario, example I have a Profiles controller, then I have a register method/action. Lets say I have 2 tables involved the users table and emails table, this is only for the sake of the demonstration. In my view in the register method there are two input boxes name which resides in the users table and email textbox for the emails table. Now what I want to do is that, when I press the submit button I want the name to be saved in the names table and the email to the emails table.. Here is the schema: users table: id name emails table: id user_id email I wonder what the view for register method would look like, since the form->create() methods 1st paramter is the name of the model.. And also how do I saved the data on two different tables. Again, thanks in advance. Philip 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
CakePHP Two Step View Pattern
Hi guys I'm new here in CakePHP. How can I implement a two step view pattern in CakePHP? Example I have a layout there are two content divs namely content1 and content2. The code is like this My Cake Blog Application css('styles');?> Can I do this in CakePHP? Cause in CodeIgniter we setup a layout and then in the layout we could display many views. How can I do that here in CakePHP? Thanks in advance.. 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Creating DatabaseTables (cakephp way)
By the way thnks for the responseActually what I want to do is the "HasOne" relationship, the problem is that I can't implement it. The problem is like this I have a users table: id integer auto increment primary firstname varchar(45) lastname varchar(45) also I have a userinformations table id integer auto increment primary sss_number varchar(45) birthday datetime user_id integer I want this to have a one to one relationship so what I did in the userinformations_controller.php class UserinformationsController extends AppController { var $name = 'Userinformations'; var $scaffold; } in the userinformation.php class Userinformation extends AppModel { var $ame = 'Userinformation'; var $belongsTo = array('User'); } in the users_controller.php class UsersController extends AppController { var $name = 'User'; var $scaffold; } in the user.php class User extends AppModel { var $name = 'User'; var $hasOne = array('Userinformation'); } After doing that, I add new users to my users table and its doneThe problem now is when I insert records on the userinformations table, I cant insert 2 or more user_id in the userinformations table. So I think the problem is on my table cause my userinformations table has an auto_increment id and also the primary key. So what I want to do is to delete the id in the userinformations table and then make the user_id a primary key so, it will have a one to one relationship with the user table. Am I right? Give me some advice on how to do it correctly. Good day. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Creating DatabaseTables (cakephp way)
hi guys, I just would like to ask about creating tables. I have read a book "Apress Beginning CakePHP" in chapter 2 it says there that "Giving each record a unique id value is essential for Cake to function without trouble. This application is simple, so you may be able to get by without creating an id field set to auto_increment. However, it’s good practice to make sure that all your records in the database can be identified by a unique value and that it’s named id, because then Cake can generate scaffolding around your table without any code on your part. Once you begin creating associated tables, then it will be mandatory to include an id field." My question is, I want to change the id field into another name, let's say category_id. Example I have a category table like this. category_table fields: category_id, name, description Will this work in the scaffolding feature? Here's my entire problemSample I have a not real world example haha... products has one to one relationship with category. product has one category category has one product product fields: id, name, description category fields category_id, name, description, product_id can this be possible using cake's scaffolding feature? if possible how? Good day. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---