CUBRID Функции
PHP Manual

cubrid_real_escape_string

(PECL CUBRID >= 8.3.0)

cubrid_real_escape_stringReturns the escaped string version of the given string

Описание

string cubrid_real_escape_string ( string $unescaped_string [, resource $conn_identifier ] )

This function returns the escaped string version of the given string. It pre-appends backslashes to the following characters: '. This function must always (with few exceptions) be used to make data safe before sending a query to CUBRID.

Список параметров

unescaped_string

The string that is to be escaped.

conn_identifier

The CUBRID connection. If the connection identifier is not specified, the last link opened by cubrid_connect() is assumed.

Возвращаемые значения

Escaped string version of the given string, on success.

FALSE on failure.

Примеры

Пример #1 cubrid_real_escape_string() example

<?php
    $user 
"'username'";
    
$password "\"pass\"";
    
$query sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
            
cubrid_real_escape_string($user),
            
cubrid_real_escape_string($password));
    
    echo 
$query;
?>

Результат выполнения данного примера:

Result:
SELECT * FROM users WHERE user='\'username\'' AND password='"pass"'

CUBRID Функции
PHP Manual