I'm trying to create a user management based on Sourdough.
When i want to update user information it will update on all existing users. I fixed that with following setWHERE id = user id
- Code: Select all
public function store($forceAll = FALSE)
{
$SQL = $this->Sourdough->SqlHelper();
$SQL->create($this->conf['table']);
// If we don't force to update all properties, only update the changed properties!
$newProperties = ($forceAll) ? $this->userProperties :
Sd_Array::diffKeys($this->userProperties, $this->storedProperties);
$SQL->bindFields($newProperties);
// Update existing user or create a new user
if ($this->userProperties['user_id']) {
// @since v0.0.1
$SQL->setWhere("user_id = " . $this->userProperties['user_id']);
$SQL->setExecMode(Sd_SqlHelper::EXEC_UPDATE);
} else {
$SQL->setExecMode(Sd_SqlHelper::EXEC_INSERT);
}
echo $SQL->getCommand();
return($SQL->execute());
}
Let me know if this is usefull!
Greetings,
John