From 4aac5d83bda58b18c6a577bcf1599a9afca2d022 Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Fri, 4 Sep 2015 21:04:10 +0000 Subject: [PATCH] Better late than never. Demonstrate that a connection is required, and what happens when one is not. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@337755 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/mysql-real-escape-string.xml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/reference/mysql/functions/mysql-real-escape-string.xml b/reference/mysql/functions/mysql-real-escape-string.xml index bdc20018be..89da8e9972 100644 --- a/reference/mysql/functions/mysql-real-escape-string.xml +++ b/reference/mysql/functions/mysql-real-escape-string.xml @@ -77,6 +77,15 @@ + + &reftitle.errors; + + Executing this function without a MySQL connection present will + also emit E_WARNING level PHP errors. Only + execute this function with a valid MySQL connection present. + + + &reftitle.examples; @@ -98,6 +107,40 @@ $query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'", + + + <function>mysql_real_escape_string</function> requires a connection example + + This example demonstrates what happens if a MySQL connection is not + present when calling this function. + + + +]]> + + &example.outputs.similar; + + + + + An example SQL Injection Attack