Update::FieldAdd

Add a field to update

Sintaxe


namespace ProtocolLive\PhpLiveDb;

function Update::FieldAdd(
string|UnitEnum $Field,
string|bool|null $Value,
Types $Type,
bool $BlankIsNull = true
):self;
Parameters

$Field - Field name. Can be null to only add Parenthesis or add Exists operator;

$Value - The field value;

$Type - The field type;

$BlankIsNull - Replace '' to null;

Notes

- When the $Value is null, the Type are changed to Types::Null;

Return

Return the same object instance for cascading calls

See more

- Types

Examples

$Db->Update('users')
->FieldAdd(
'pwd',
password_hash($_POST['email'], PASSWORD_DEFAULT),
Types::Str
)
->WhereAdd(
'email',
$_POST['email'],
Types::Str
)
->Run();
//update users set pwd=:pwd where email=:email
//update users set pwd='43v6qtq8otg8otob' where email='foo@bar.com'