Friday, 8 January 2016

Stopping MySQL PHP connection with mysql_close ()


PHP with MySQL connection will be terminated automatically when the program execution is completed, which is when the PHP page is finished processing, so we do not need to manually menghentikanya.

But if you want to stop the connection with MySQL when the program is running PHP, PHP provides a function mysql_close (). This function takes one argument which is filled with the fruit of the variable 'link connection' results call mysql_connect () function. This connection variable is optional, and if omitted, PHP will use the last mysql connection.


Here is an example of using a function mysql_close ():

 or by the PHP function that is often used when connecting to MySQL is a function die () and exit ().

As the name implies, this function aims to 'kill' or 'out' of PHP. Both of these functions aims to make the process stops PHP processed at that time (when the function is called).

Before the 'suicide', the function die () and exit () can display the "last message".

Here are the use of the function die () to create a connection between PHP with MySQL:



No comments:

Post a Comment