If using Cakes HABTM automagic the table should be named
classes_teachers and have the following fields

id (primary_key, auto_inc)
class_id
teacher_id

After that it's a case of
INSERT INTO classes_teachers (class_id, teacher_id) SELECT class_id,
teacher_id FROM import_table

HTH, Paul
@phpMagpie

On Sep 15, 9:24 pm, "porangi.chris" <porangi.ch...@gmail.com> wrote:
> hi,
>
> First time user of cake with CI background,  I have two tables
> teachers and classes that share a many to many relationship e.g.
> Teacher-Classes.
>
> I'm having to import the data from CSV files that have been exported
> from another system that we have limited access to.    I've got the
> classes working - I can scan through the file and add the class if it
> doesn't already exist but I need to add the links between class and
> teacher.
>
> I have an associative array with the two ids (tclass_id and
> teacher_id) ready but what query call would I make to insert this as a
> row in the teacher_class table?
>
> Thanks in advance for any help.
>
> Chris

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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

Reply via email to