mysqli_escape_string

(PHP 5, PHP 7)

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
2 months 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
1 year 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
10 months ago
$string = $conn->escape_string($_POST["data"]);
To Top