dbx_escape_string

(PHP 4 >= 4.3.0, PHP 5 < 5.1.0, PECL dbx >= 1.1.0)

dbx_escape_string Escape a string so it can safely be used in an sql-statement

说明

dbx_escape_string ( object $link_identifier , string $text ) : string

Escape the given string so that it can safely be used in an sql-statement.

参数

link_identifier

The DBX link object returned by dbx_connect()

text

The string to escape.

返回值

Returns the text, escaped where necessary (such as quotes, backslashes etc). On error, NULL is returned.

范例

Example #1 dbx_escape_string() example

<?php
$link   
dbx_connect(DBX_MYSQL"localhost""db""username""password")
    or die(
"Could not connect");

$text dbx_escape_string($link"It\'s quoted and backslashed (\\).");
$result dbx_query($link"insert into tbl (txt) values ('" $text "')");
if (
$result == 0) {
    echo 
dbx_error($link);
}
dbx_close($link);
?>

参见

  • dbx_query() - Send a query and fetch all results (if any)

相关文章
php cubrid 函数 execute a prepared sql statementphp cubrid 函数 bind a lob object or a string as a lob object to a prepared statement as parametersphp cubrid mysql 兼容性函数 escape special characters in a string for use in an sql statementphp ibm db2 函数 binds a php variable to an sql statement parameterphp ibm db2 函数 returns the number of rows affected by an sql statementphp ibm db2 函数 prepares an sql statement to be executedphp ibm db2 函数 returns a string containing the sqlstate returned by an sql statementphp ibm db2 函数 returns a string containing the last sql statement error messagephp dbx 函数 escape a string so it can safely be used in an sql statementphp eio 函数 can be to be called whenever there are pending requests that need finishingphp mcve 函数 returns array of strings which represents the keys that can be used for response parameters on this transactionphp maxdb 函数 别名 maxdb real escape stringphp maxdb 函数 escapes special characters in a string for use in an sql statement taking into account the current charset of the connectionphp maxdb 函数 returns a string description for last statement errorphp 别名和过时的 mysqli 函数 别名 mysqli real escape stringphp ncurses 函数 apply padding information to the string and output itphp odbc 函数 prepare and execute an sql statementphp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp win32service 函数 registers the script with the scm so that it can act as the service with the given namephp gearmanworker give the worker an identifier so it can be tracked when asking gearmand for the list of available workers
关注编程学问公众号