In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
In this issue, the editor will bring you about how php prints database error messages. The article is rich in content and analyzes and narrates it from a professional perspective. I hope you can get something after reading this article.
Php print database error message method: 1, create a PHP sample file; 2, connect to the database through mysql_connect; 3, print database error message through mysql_error function.
This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer.
How does php print database error messages?
The code is as follows:
$link = @ mysql_connect ("server", "account", "password") or die ("own error interpretation" .mysql _ error ()); echo mysql_error (); / / print data error message
Related introduction:
Mysql_error
(PHP 4, PHP 5)
Mysql_error-returns the text error message generated by the previous MySQL operation
Description
Mysql_error (resource $link_identifier =?): string
Returns the error text of the previous MySQL function, or''(empty string) if there is no error. If the connection resource number is not specified, the error message is extracted from the MySQL server using the last successful connection.
Errors from the back end of the MySQL database no longer issue warnings, and mysql_error () is used to extract the error text. Note that this function only returns the error text of the last execution of the MySQL function (excluding mysql_error () and mysql_errno ()), so if you want to use this function, be sure to check its value before calling another MySQL function.
Mysqli_error ()
The mysqli_error () function returns the last error description of the recently called function.
Grammar
Mysqli_error (connection)
Parameters.
Connection is required. Specifies the MySQL connection to be used.
Return value: returns a string with an error description. Returns "" if no error occurs.
PHP version: 5 +
The above is the editor for you to share the php how to print database error messages, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.