In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to clean client data with mysql_real_escape_string on the server side". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to clean client data with mysql_real_escape_string on the server side.
Because mysql_real_escape_string requires a MySQL database connection, you must connect to the MySQL database before calling mysql_real_escape_string.
PHP:
Call method
PHP:
The cleaned data can be inserted directly.
Be careful! _ real_escape_string must be used (PHP 4 > = 4.3.0, PHP 5). Otherwise, you can only use mysql_escape_string. The difference between the two is:
Mysql_real_escape_string takes into account the current character set of the connection, while mysql_escape_string does not.
Because mysql_real_escape_string requires a MySQL database connection, you must connect to the MySQL database before calling mysql_real_escape_string.
When we know that the data type is a string, we can limit the string length while cleaning the data. This method comes from David Lane, Hugh E. Williams "Web Database Application with PHP and MySQL" (OReilly, May 2004)
PHP:
Call method:
PHP:
Clean the username in the $_ POST array and truncate the first 20 characters.
At this point, I believe you have a deeper understanding of "how to clean client data with mysql_real_escape_string on the server side". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.