string TableName,
 array fields,
 string FileDir="",
 string lang=false,
 string TableAlias = ""

The method prepares a string for issuing an SQL query used to upd ate a record in the database. Returns the string of the format "field name1=value1, field name2= value2[, ...]". The method converts all values to the SQL-compliant format with respect to the field type. Non-static method.


ParameterDescriptionAvailable fr om version
TableNameName of name.
fieldsArray of field values in the format of "field name1"=>"value1", "field name2"=>"value2" [, ...].
Use a value of false to insert NULL.
FileDirNot used.
langSite ID (for public section) or the language ID (for administrative section). Used to determine the date format when inserting fields of the type date or datetime.
Optional; false by default.

See Also

Examples of use

function UpdateResultField($arFields, $RESULT_ID, $FIELD_ID)
	$err_mess = (CForm::err_mess())."<br>Function: UpdateResultField<br>Line: ";
	global $DB;
	$RESULT_ID = intval($RESULT_ID);
	$FIELD_ID = intval($FIELD_ID);
	$strUpdate = $DB->PrepareUpdate("b_form_result_answer", $arFields, "form");
	$strSql = "UPDATE b_form_result_answer SE T ".$strUpdate." WH ERE RESULT_ID=".$RESULT_ID." and FIELD_ID=".$FIELD_ID;
	$DB->Query($strSql, false, $err_mess.__LINE__);

© «Bitrix24», 2001-2023