Log in

View Full Version : datamanager update


loneranger
02-02-2008, 04:39 PM
hi i am trying to use custom datamangers i have got it working for insert and delete but am unable to get it to update i have look throught the forum with no luck i think it has something to do with $condition_construct but have also seen about setting exisitng array any help would be much appricated

Opserty
02-02-2008, 05:11 PM
Heres an example using the User Datamanager

$someuserid = 62;
$someuserinfo = fetch_userinfo($someuserid);

// $userdm = datamanager_init('User'...
$userdm->set_existing($someuserinfo);
$userdm->set('username', 'SomeotherName');

$userdm->save();


So you use the set_existing() function of the datamanger then just set the bits you want changed.

loneranger
02-02-2008, 05:32 PM
thanks for our quick reply i have done a mysql query to fetch all table fields

$results=$vbulletin->db->query_read("SELECT * FROM cm_squads WHERE squad_id='$squad_id'");

$row = $vbulletin->db->fetch_array($results)



i then set_existing($row) and get an error $row is not an array can you see any errors this is really bugging me if i echo $row it prints ARRAY

--------------- Added 1201981807 at 1201981807 ---------------

got it sorted anyone who is interested i done
$row=array("IDFIELD" => $idvalue);
$dm->set_existing($row);