Thanks for that, but I'm new to cakephp and I'm trying to translate the SQL to fetch the key into cake, but as I said I'm new and not exactly sure how to do it...
SELECT id FROM weeks WHERE now( ) BETWEEN start AND end; So far, I have this... $Week->findAll(array('now()' => 'BETWEEN start AND end')); This comes up with an undefined variable error. Any help would be great, thanks. On Apr 23, 4:21 pm, brian <bally.z...@gmail.com> wrote: > You could add the foreign key in a beforeSave() routine but, probably > a much simpler way would be to fetch the key you want based on the > date in your register action. Then add a hidden input to the form with > that value. > > function register() > { > if (!empty($this->data)) > { > > } > > $this->set( > 'the_key', > $this->Model->OtherModel->getYourKey() > ); > > } > > echo $form->hidden('the_key', array('value' => $the_key)); > > On Thu, Apr 23, 2009 at 11:50 AM, smithtrev...@googlemail.com > > <smithtrev...@googlemail.com> wrote: > > > It's part of the site logic. Everytime a new user registers, it needs > > to be able to decide what week number (week_id), they are starting in > > based on it being betweek the start and end date in another table. > > > On Apr 23, 3:44 pm, Faza <f...@ansi.pl> wrote: > >> want to do it using Cake or just plain good ol' SQL? Also, is it a > >> one-timer, or is it a part of your site logic? > > >> smithtrev...@googlemail.com pisze: > > >> > Hi, > >> > I have a question, if I wanted to update a foreignkey field in a > >> > table, based on a date range in another table (eg. it has an id, > >> > startdate, enddate). How would I do that? > > >> > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---