本文整理匯總了PHP中CSaleUser::CheckFields方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSaleUser::CheckFields方法的具體用法?PHP CSaleUser::CheckFields怎麽用?PHP CSaleUser::CheckFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSaleUser
的用法示例。
在下文中一共展示了CSaleUser::CheckFields方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _Update
function _Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSaleUser::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_sale_fuser", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
$strSql = "UPDATE b_sale_fuser SET " . $strUpdate . " WHERE ID = " . $ID . " ";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return $ID;
}
示例2: _Add
public static function _Add($arFields)
{
global $DB;
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSaleUser::CheckFields("ADD", $arFields)) {
return false;
}
$arInsert = $DB->PrepareInsert("b_sale_fuser", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($arInsert[0]) > 0) {
$arInsert[0] .= ", ";
}
$arInsert[0] .= $key;
if (strlen($arInsert[1]) > 0) {
$arInsert[1] .= ", ";
}
$arInsert[1] .= $value;
}
$strSql = "INSERT INTO b_sale_fuser(" . $arInsert[0] . ") " . "VALUES(" . $arInsert[1] . ")";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
$ID = IntVal($DB->LastID());
return $ID;
}