book.cakephp.org/view/1031/Saving-Your-Data) has the following
information box:
The $fields array accepts SQL expressions. Literal values should be
quoted manually.
It's a bit terse, but basically it's saying that if you want to update
a field with a specific string value, you need to include quotes as
part of the string. Without the quotes, your string is interpreted as
an SQL expression; so your database is thinking that sky is a column
name and not a literal value. This allows you to reference columns in
the "value", e.g. array('Post.counter' => 'counter + 1'). Since
updateAll() automatically joins belongsTo tables, this can be
particularly powerful. Note that this applies only to the $fields
array, and differs significantly from the $conditions array.
Your code should be:
$this->Theme->updateAll(array('Theme.name' => '"' . $name . '"'),
array('Theme.user_id' => $id));
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment