$m = DataObject::get_one('Member',"Email ='".$someEmailAddress."'");
Also better make sure $someEmailAddress is SQL safe as well as SS won't do this magically for you. If $someEmailAddress is a user input (like a form) you should do $someEmailAddress = Convert::raw2sql($someEmailAddress); before the dataobject get line.
True, didn't thought of a userinput case.
Thanks. But I can't seem to use this the same way I use Member::
$member = DataObject::get_one("Member", "`Email` = [email protected]'"); $member->CustomField = 'Hello'; $member->write();
I am trying to change the value of CustomField to "Hello".
That is the correct way, write() should save it to the database. Does it not update the member table? How have you added that CustomField to the database (eg via a decorator?)