MySQL Functions
PHP Manual

mysql_close

(PHP 4, PHP 5)

mysql_closeبستن اتصال MySQL

Description

bool mysql_close ([ resource $link_identifier ] )

mysql_close() اتصال غیردائمی به MySQL server را که مشخص شده است می‌بندد.اگر link_identifier مشخص شده باشد آخرین پیوند باز را مورد استفاده قرار می‌دهد.

استفاده از mysql_close() معمولا مورد نیاز نیست اتصالات باز غیر دائمی به صورت خودکار در پایان اجرای اسکریپت بسته می‌شود. همچنین آزاد کردن منابع را ببینید.

Parameters

link_identifier

The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If no connection is found or established, an E_WARNING level error is generated.

Return Values

Returns TRUE on success or FALSE on failure.

Examples

Example #1 مثال mysql_close()

<?php
$link 
mysql_connect('localhost''mysql_user''mysql_password');
if (!
$link) {
    die(
'Could not connect: ' mysql_error());
}
echo 
'Connected successfully';
mysql_close($link);
?>

The above example will output:

Connected successfully

Notes

Note:

mysql_close()پیوند‌های دائمی ایجاد شده توسطmysql_pconnect() را نمی‌بندد.

See Also


MySQL Functions
PHP Manual