Re: Updating is creating new record

2010-06-17 Thread Walther
Just remember that updateAll does not sanitize inputs like save and
saveField does and so may open your app to SQL injection attacks
unless you manually sanitize the user inputs.

On Jun 16, 12:28 pm, WhyNotSmile sharongilmor...@gmail.com wrote:
 Thanks for all the replies.

 I got it working by using updateAll, as Sergei suggested.  Still not
 sure why it wasn't working, but at least it is now!

 Thanks again for all the help.

 Sharon

 On 14 June, 03:30, Sergei yatse...@gmail.com wrote:

  Try this

  $user['User']['id']=...
  $user['User']['field']=...
  $user['User']['anotherfield']=...
  $this-save($user);

  also there is updateAll() function.

  On Jun 13, 5:05 am, WhyNotSmile sharongilmor...@gmail.com wrote:

   Thanks John, but saveField isn't doing the job either.

   Sharon

   On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:

Can you just use $this-saveField('friend_list', $friendslist) instead
of $this-save()?
Enjoy,
   John

On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:

 I'm trying to update a field in a record, using the following code:

    $this-id = $user['User']['id'];
    $this-set('friends_list', $friendslist);
    $this-save();

 The record with id $user['User']['id'] exists in the db; I'm just
 trying to update the friends_list field.

 When I do this, though, it creates a whole new record - I thought that
 if id was set, then it updated the record with that id?  If I
 explicitly set id, e.g.:

 $this-set(array('friends_list = $friendslist, $id = $user['User']
 ['id']));

 if complains that a record with the primary key $user['User']['id']
 already exists.

 Does anyone know what I'm doing wrong?  Thanks!



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-16 Thread WhyNotSmile
Thanks for all the replies.

I got it working by using updateAll, as Sergei suggested.  Still not
sure why it wasn't working, but at least it is now!

Thanks again for all the help.

Sharon



On 14 June, 03:30, Sergei yatse...@gmail.com wrote:
 Try this

 $user['User']['id']=...
 $user['User']['field']=...
 $user['User']['anotherfield']=...
 $this-save($user);

 also there is updateAll() function.

 On Jun 13, 5:05 am, WhyNotSmile sharongilmor...@gmail.com wrote:

  Thanks John, but saveField isn't doing the job either.

  Sharon

  On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:

   Can you just use $this-saveField('friend_list', $friendslist) instead
   of $this-save()?
   Enjoy,
      John

   On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:

I'm trying to update a field in a record, using the following code:

   $this-id = $user['User']['id'];
   $this-set('friends_list', $friendslist);
   $this-save();

The record with id $user['User']['id'] exists in the db; I'm just
trying to update the friends_list field.

When I do this, though, it creates a whole new record - I thought that
if id was set, then it updated the record with that id?  If I
explicitly set id, e.g.:

$this-set(array('friends_list = $friendslist, $id = $user['User']
['id']));

if complains that a record with the primary key $user['User']['id']
already exists.

Does anyone know what I'm doing wrong?  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-13 Thread Sergei
Try this

$user['User']['id']=...
$user['User']['field']=...
$user['User']['anotherfield']=...
$this-save($user);

also there is updateAll() function.

On Jun 13, 5:05 am, WhyNotSmile sharongilmor...@gmail.com wrote:
 Thanks John, but saveField isn't doing the job either.

 Sharon

 On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:



  Can you just use $this-saveField('friend_list', $friendslist) instead
  of $this-save()?
  Enjoy,
     John

  On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:

   I'm trying to update a field in a record, using the following code:

      $this-id = $user['User']['id'];
      $this-set('friends_list', $friendslist);
      $this-save();

   The record with id $user['User']['id'] exists in the db; I'm just
   trying to update the friends_list field.

   When I do this, though, it creates a whole new record - I thought that
   if id was set, then it updated the record with that id?  If I
   explicitly set id, e.g.:

   $this-set(array('friends_list = $friendslist, $id = $user['User']
   ['id']));

   if complains that a record with the primary key $user['User']['id']
   already exists.

   Does anyone know what I'm doing wrong?  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-12 Thread John Andersen
Can you just use $this-saveField('friend_list', $friendslist) instead
of $this-save()?
Enjoy,
   John

On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:
 I'm trying to update a field in a record, using the following code:

    $this-id = $user['User']['id'];
    $this-set('friends_list', $friendslist);
    $this-save();

 The record with id $user['User']['id'] exists in the db; I'm just
 trying to update the friends_list field.

 When I do this, though, it creates a whole new record - I thought that
 if id was set, then it updated the record with that id?  If I
 explicitly set id, e.g.:

 $this-set(array('friends_list = $friendslist, $id = $user['User']
 ['id']));

 if complains that a record with the primary key $user['User']['id']
 already exists.

 Does anyone know what I'm doing wrong?  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-12 Thread WhyNotSmile
Thanks John, but saveField isn't doing the job either.

Sharon


On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:
 Can you just use $this-saveField('friend_list', $friendslist) instead
 of $this-save()?
 Enjoy,
    John

 On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:

  I'm trying to update a field in a record, using the following code:

     $this-id = $user['User']['id'];
     $this-set('friends_list', $friendslist);
     $this-save();

  The record with id $user['User']['id'] exists in the db; I'm just
  trying to update the friends_list field.

  When I do this, though, it creates a whole new record - I thought that
  if id was set, then it updated the record with that id?  If I
  explicitly set id, e.g.:

  $this-set(array('friends_list = $friendslist, $id = $user['User']
  ['id']));

  if complains that a record with the primary key $user['User']['id']
  already exists.

  Does anyone know what I'm doing wrong?  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-12 Thread Ma'moon
Are you doing it AJAX? and what is the data type of the coolumn
friends_list?

On Sat, Jun 12, 2010 at 4:05 PM, WhyNotSmile sharongilmor...@gmail.comwrote:

 Thanks John, but saveField isn't doing the job either.

 Sharon


 On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:
  Can you just use $this-saveField('friend_list', $friendslist) instead
  of $this-save()?
  Enjoy,
 John
 
  On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:
 
   I'm trying to update a field in a record, using the following code:
 
  $this-id = $user['User']['id'];
  $this-set('friends_list', $friendslist);
  $this-save();
 
   The record with id $user['User']['id'] exists in the db; I'm just
   trying to update the friends_list field.
 
   When I do this, though, it creates a whole new record - I thought that
   if id was set, then it updated the record with that id?  If I
   explicitly set id, e.g.:
 
   $this-set(array('friends_list = $friendslist, $id = $user['User']
   ['id']));
 
   if complains that a record with the primary key $user['User']['id']
   already exists.
 
   Does anyone know what I'm doing wrong?  Thanks!

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-12 Thread John Andersen
Did you still use the setting of the id in the model first?
[code]
 $this-id = $user['User']['id'];
 $this-saveField( ... );
[/code]
It should work!
Enjoy,
   John

On Jun 12, 11:05 pm, WhyNotSmile sharongilmor...@gmail.com wrote:
 Thanks John, but saveField isn't doing the job either.

 Sharon

 On 12 June, 18:07, John Andersen j.andersen...@gmail.com wrote:

  Can you just use $this-saveField('friend_list', $friendslist) instead
  of $this-save()?
  Enjoy,
     John

  On Jun 12, 7:57 pm, WhyNotSmile sharongilmor...@gmail.com wrote:

   I'm trying to update a field in a record, using the following code:

      $this-id = $user['User']['id'];
      $this-set('friends_list', $friendslist);
      $this-save();

   The record with id $user['User']['id'] exists in the db; I'm just
   trying to update the friends_list field.

   When I do this, though, it creates a whole new record - I thought that
   if id was set, then it updated the record with that id?  If I
   explicitly set id, e.g.:

   $this-set(array('friends_list = $friendslist, $id = $user['User']
   ['id']));

   if complains that a record with the primary key $user['User']['id']
   already exists.

   Does anyone know what I'm doing wrong?  Thanks!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Updating is creating new record

2010-06-12 Thread Zaky Katalan-Ezra
$this-data-['User']['id'] = $user['User']['id'];

On Sat, Jun 12, 2010 at 7:57 PM, WhyNotSmile sharongilmor...@gmail.comwrote:

 I'm trying to update a field in a record, using the following code:

   $this-id = $user['User']['id'];
   $this-set('friends_list', $friendslist);
   $this-save();

 The record with id $user['User']['id'] exists in the db; I'm just
 trying to update the friends_list field.

 When I do this, though, it creates a whole new record - I thought that
 if id was set, then it updated the record with that id?  If I
 explicitly set id, e.g.:

 $this-set(array('friends_list = $friendslist, $id = $user['User']
 ['id']));

 if complains that a record with the primary key $user['User']['id']
 already exists.

 Does anyone know what I'm doing wrong?  Thanks!

 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.

 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.comcake-php%2bunsubscr...@googlegroups.comFor
  more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en


Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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