Description
This function is an alias of: mysqli_real_escape_string().
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- MySQL Drivers and Plugins
- Улучшенный модуль MySQL
- mysqli_bind_param
- mysqli_bind_result
- mysqli_client_encoding
- mysqli_connect
- mysqli::disable_reads_from_master
- mysqli_disable_rpl_parse
- mysqli_enable_reads_from_master
- mysqli_enable_rpl_parse
- mysqli_escape_string
- mysqli_execute
- mysqli_fetch
- mysqli_get_cache_stats
- mysqli_get_links_stats
- mysqli_get_metadata
- mysqli_master_query
- mysqli_param_count
- mysqli_report
- mysqli_rpl_parse_enabled
- mysqli_rpl_probe
- mysqli_send_long_data
- mysqli::set_opt
- mysqli_slave_query
Коментарии
mysqli_escape_string is a shorter name than mysqli_real_escape_string and doesn’t seem to be deprecated, so you might as well save typing.
$string = $conn->escape_string($_POST["data"]);
I'm not sure why
$string = $conn->escape_string($_POST["data"]);
has been downvoted into obvlivian, but it is the only thing that works if you're using the mysqli class.
For example
<?php
print "function output: " . mysqli_escape_string($_REQUEST["foo"]) . "\n";
print "method output: " . $mysqli->escape_string($_REQUEST["foo"]) . "\n";
?>
prints:
function output:
method output: bar
This is with php 7.0