On Feb 15, 2011, at 00:11, [email protected] wrote: > 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...
You haven't told us in what way this fails, but I'm guessing you're getting an SQL syntax error, because that SQL doesn't look right. Typically, SQL would look like: UPDATE table SET field1=value1, field2=value2 WHERE field3=value3 AND field4=value4; You haven't given a WHERE condition in your SQL statement, and you're using the AND conjunction in your SET clause, when you're only allowed to use that in your WHERE clause. You do know CakePHP has a bunch of ways that you can save your data to the database without resorting to writing SQL statements yourself, right? -- 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 [email protected] For more options, visit this group at http://groups.google.com/group/cake-php
