PHP Velho Oeste 2024

mysqli::escape_string

mysqli_escape_string

(PHP 5, PHP 7, PHP 8)

mysqli::escape_string -- mysqli_escape_stringAlias of mysqli_real_escape_string()

Description

This function is an alias of: mysqli_real_escape_string().

add a note add a note

User Contributed Notes 3 notes

up
-1
Tom Cat
5 years ago
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
up
-40
Lawrence DOliveiro
6 years ago
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.
up
-39
Anonymous
5 years ago
$string = $conn->escape_string($_POST["data"]);
To Top