The first thing you are doing wrong is using Model->query; you might as well skip Cake altogether and write your app in plain old PHP.
You raised a similar query a few days ago, and this warrants the same solution. Here it is again (amended with your new models and fields): Sounds like you need to have a line of code in the controller's view method that calls a simple model function: $this->FocikiGuest->recordVisit($id, $user['User']['id'], $this->user['id']); In the model: function recordVisit($id, $userId, $guestId) { $this->updateAll( array( 'FocikiGuest.user_id' => $userId, 'FocikiGuest.guest_id' => $guestId ), array('FocikiGuest.id' => $id) ); } Or you could just call it directly from the view method in the controller: $this-> FocikiGuest->updateAll( array( 'FocikiGuest.user_id' => $user['User']['id'], 'FocikiGuest.guest_id' => $this->user['id'] ), array('FocikiGuest.id' => $id) ); This way, whenever the view method is called (in other words, each time the page is rendered) you record the user_id and guest_id. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 15 Feb 2011, at 06:11, chris...@yahoo.com wrote: > Hi All, > Ok guys, what am I doing wrong...? > > $this->Guest->query('UPDATE fociki_guests' . 'SET user_id = > ($user['User']['id'])' . ' AND guest_id = ($this->user['id'])'); > > I need to update guest table every time its accessed by users to any > User page. First I need to make this code straight it up... Please > help. I can't make it work... > > Thanks > 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 -- 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