Collections functions
Encryption functions
General functions
Render functions
Theme permission functions
Video functions
Resource functions

sql_null_or_val()

Description

Query helper function for insert/update statements to avoid repetitive checks when value might be NULL or an actual value.
Helps keeping database level data as expected (ie. uses an actual NULL value when there's no data as opposed to empty strings)

Parameters

ColumnTypeDefaultDescription
$v string Non-null value
$cond boolean Condition to set it to NULL or to use the escaped value

Return

string

This article was last updated 18th January 2021 09:35 Europe/London time based on the source file dated 13th January 2021 13:50 Europe/London time.