Disconnecting from a Database

To disconnect from the MySQL server, we use the mysql_close() function. Here's the line of code we'll use:

mysql_close (mysql);

It's not complicated: This line closes the MySQL connection referenced by the argument passed here as mysql.

Get Sams Teach Yourself MySQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.