Documentation

ForSql

string
CDatabase::ForSql(
 string value,
 int max_length=0
)

The method prepares the string for insertion into an SQL query (replaces quotes etc.) and optionally truncates it to a specified maximum length, if the max_length parameter is specified. Non-static method.

Parameters

ParameterDescription
value Original string.
max_length Maximum length.
Optional; by default (0) the string is not truncated.

See Also

Examples of use

<?
$strSql = "
    SEL ECT 
        ID 
    FR OM 
        b_stat_phrase_list 
    WHERE 
        PHRASE='".$DB->ForSql($search_phrase)."' 
    and SESSION_ID='".$_SESSION["SESS_SESSION_ID"]."'
    ";
$w = $DB->Query($strSql, false, $err_mess.__LINE__);
?>


© «Bitrix24», 2001-2024