Hi, I use cakephp a lot but only today did I have a need for using the HABTM association.
My application is such that I have 3 tables - 1. Users 2. Profiles 3. Contests Users table has username/passwd/name/email, Profiles has lot of other info and Contests has some competition running. I think that if I had to link Profiles & Contests I had to do a Profile hasAndBelongToMany contests and a Contest hasAndBelongsToMany Profiles. For this I created a join table - contests_profile with contest_id & profile_id Now when I run a findAll from contests controller, I get an sql error and same is the case from profiles controller. I don't know if it's a problem with my association definition, or my table structure or mysql version or php config entry (does something need to be enabled)? I have pasted some bit of my code here - http://cakephp.org/pastes/show/70b4b7d9566a8d1595cb352637265eb2 BTW, in it's simplest form the following query is run - SELECT `Profile`.`id`, `Profile`.`modified` FROM `profiles` AS `Profile` JOIN `contests_profiles` ON `contests_profiles`.`contest_id` = '1' AND `contests_profiles`.`profile_id` = `Profile`.`id` WHERE 1 = 1 And I get the following error: MySQL said: Documentation #1064 - You have an error in your SQL syntax near 'ON `contests_profiles` . `contest_id` = '1' AND `contests_profiles` . `profile_i' at line 1 Could someone guru please help me out. Thanks in advance, Mandy. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---