Alfonso Sermonti Wed Feb 09 05:16:57 -0500 2011

Subject: Weird update behavior

According to the wiki, I tried to do a mass update on my db

I did:
User::table()->update(array('usercat_id' => 3,'name'=>'paola'),array('usercat_id' => 4));
and I received this error message from PHP:
Fatal error: Cannot pass parameter 1 by reference in E:\Web\dev\mysite\index.php on line 66

I tried to figure out what is happened, then I tried with the following syntax:
$update = array('usercat_id' => 3,'name'=>'paola');
$find = array('usercat_id' => 4);
User::table()->update($update,$find);
and everything gone right

What kind of mistake I did with the first syntax?


Jono B Thu Feb 10 09:24:46 -0500 2011

Try this maybe:

User::table()->update(array('usercat_id' => 3,'name'=>'paola'),array('usercat_id' => array(4)));

Alfonso Sermonti Thu Feb 10 09:33:26 -0500 2011

Thank you Jono, but it doesn't work... :-(

Stephen Blackstone Thu May 05 11:57:48 -0400 2011
Yoan B Thu May 05 16:19:56 -0400 2011

This might change one day, but in the meantime (like Stephen pointed out):

1 $data = array('usercat_id' => 3,'name'=>'paola')
2 User::table()->update($data, array('usercat_id' => 4));

(1-4/4)