php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41227 mysql_real_escape_string
Submitted: 2007-04-29 18:16 UTC Modified: 2007-04-30 13:22 UTC
From: php_debugger at yahoo dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5.2.1 OS: Windows XP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: php_debugger at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-04-29 18:16 UTC] php_debugger at yahoo dot com
Description:
------------
I have met this "bug" while I was creating a Russian site. I have a web form(ENCODING:UTF-8) and a simple query(My db uses UTF-8). When I submit the form, I get an error which says that the string is too long for the column but it is not the case(I just type the letters).

After a while debugging I have found out what is the problem. When I use mysql_real_escape_string() I get the error else I do not.

I have searched in the php site but I found nothing which has to do with encoding.

Reproduce code:
---------------
//I will give only the php code though it is very simple
<?php
//MySQL connections and other stuff like this has been omitted because //of the code's size
$name = mysql_real_escape_string($_POST['name']);

mysql_query("insert into users set name='".$name."');
?>

Expected result:
----------------
No errors.

Actual result:
--------------
MySQL error which says that the string is too long.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-29 23:18 UTC] judas dot iscariote at gmail dot com
You should use mysqli and the mysqli_set_charset() function.
 [2007-04-30 13:22 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 27 04:00:03 2025 UTC