Looks like you've got the order wrong - SET then WHERE, not WHERE then
SET

http://dev.mysql.com/doc/refman/5.0/en/update.html :

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
    SET col_name1=expr1 [, col_name2=expr2 ...]
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

So it should be (also note the quotes)

$this->User->execute("UPDATE users SET
friends_list=CONCAT(friends_list, '$friendName') WHERE
username='$username'");

Or, the paranoid version:

$this->User->execute(sprintf("UPDATE `users` SET
`friends_list`=CONCAT(`friends_list`, '%s') WHERE `username`='%s'",
  Sanitize::escape($friendName),
  Sanitize::escape($username)
));

On Jan 27, 8:40 pm, "Samuel DeVore" <[EMAIL PROTECTED]> wrote:
> On Jan 27, 2008 1:14 PM, matches <[EMAIL PROTECTED]> wrote:
>
>
>
> > Yeah, I get the same error as above with single quotes and the
> > following error with double quotes around my string variables (that's
> > what you meant right).
>
> like this
>
> $this->User->execute("UPDATE 'users' WHERE 'username' = \"$username\" SET
> 'friends_list' = concat(friends_list, \"$friendName\")");
>
> mysql wants strings around the strings you are using in your search
> arguments  have you tried this query directly in mysql?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to