PHP | mysqli_error() Function Last Updated : 23 Apr, 2020 Comments Improve Suggest changes Like Article Like Report The mysqli_error() function is used to return the error in the most recent MySQL function call that failed. If there are multiple MySQL function calls, the error in the last statement is the one that is pointed out by the function. Syntax: mysqli_error("database_name") Parameters: This function accepts single parameter as mentioned above and described below: database_name: It is the database on which operations are being performed. It is a mandatory parameter. Program 1: php <?php $conn = mysqli_connect( "localhost", "root", "", "Persons"); // Check connection if (mysqli_connect_errno()) { echo "Database connection failed."; } // Check for error in query if (!mysqli_query($link, "SET Age=1")) { printf("Error message: %s\n", mysqli_error($conn)); } mysqli_close($conn); ?> Suppose the operation is being carried out on the table given below: The output will be: Error message: Unknown system variable 'Age' Program 2: php <?php $conn = mysqli_connect( "localhost", "root", "", "Persons"); // Check connection if (mysqli_connect_errno()) { echo "Database connection failed."; } // Check for error in query if (!mysqli_query($link, "SET Firstname='Arkadyuti'")) { printf("Error message: %s\n", mysqli_error()); } mysqli_close($conn); ?> Output: Error message: mysqli_error() expects exactly 1 parameter, 0 given This example also demonstrates that mysqli_error() needs a database as a parameter. Comment More infoAdvertise with us Next Article PHP | mysqli_error() Function A ArkadyutiBanerjee Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-MySQL Similar Reads PHP | mysqli_close() Function MySQLi Procedural procedure: To close the connection in mysql database we use php function mysqli_close() which disconnect from database. It require a parameter which is a connection returned by the mysql_connect function. Syntax: mysqli_close(conn); If the parameter is not specified in mysqli_close 2 min read PHP mysqli_connect() Function The mysqli_connect() function in PHP is a fundamental tool for establishing a connection to a MySQL database. This function is crucial for PHP applications that need to interact with MySQL databases, enabling them to execute queries, retrieve data, and perform various database operations.In this art 3 min read PHP | mysqli_fetch_array() Function The mysqli_fetch_array() function is used to fetch rows from the database and store them as an array. The array can be fetched as an associative array, as a numeric array or both. Associative arrays are the arrays where the indexes are the names of the individual columns of the table. On the other h 2 min read PHP | mysqli_ping() Function The mysqli_ping() function is used to ping a server connection. That is it is used to check if a host is reachable on an IP network or not. This function also tries to reconnect if an existing server connection is lost. To use this function, it is mandatory to first set up the connection with the My 2 min read PHP error_get_last() Function The error_get_last() function is an inbuilt PHP function in PHP which is used to get the last error that occurred. Syntax: error_get_last(): ?arrayParameter: This function does not accept any parameters. Return Value: It returns an associate array that explains the last error with keys "type", "mess 1 min read PHP error_clear_last() Function The error_clear_last() function is an inbuilt function in PHP that is utilized to remove the most recent error. Syntax: error_clear_last(): void Parameter: This function does not accept any parameters. Return Value: The most recent error will be cleared & making it impossible to retrieve that er 1 min read PHP | is_array() Function The is_array() is an inbuilt function in PHP. The is_array() function is used to check whether a variable is an array or not. Syntax: bool is_array($variable_name) Parameter: This function accept a single parameter as mentioned above and described below: $variable_name: This parameter holds the vari 2 min read PHP min( ) Function The min() function of PHP is used to find the lowest value in an array, or the lowest value of several specified values. The min() function can take an array or several numbers as an argument and return the numerically minimum value among the passed parameters. The return type is not fixed, it can b 2 min read PHP Array Functions Arrays are one of the fundamental data structures in PHP. They are widely used to store multiple values in a single variable and can store different types of data, such as strings, integers, and even other arrays. PHP offers a large set of built-in functions to perform various operations on arrays. 7 min read PHP | mysqli_num_rows() Function The mysqli_num_rows() function is an inbuilt function in PHP which is used to return the number of rows present in the result set. It is generally used to check if data is present in the database or not. To use this function, it is mandatory to first set up the connection with the MySQL database. Sy 2 min read Like