Forum Moderators: coopster

Message Too Old, No Replies

end it for ever script.

mysql_close()

         

camilord

2:10 pm on Apr 9, 2007 (gmt 0)

10+ Year Member




greetings my fellow PHP programmers.. :)

just want to ask..

is it important to close your query and unset() you unused variables and sessions?

for example i query my users... do i really have to end it...

<?php
inlcude("dbConnect.php");

$result = mysql_query("select * from users where id = 1");
$exist = mysql_num_rows($result);

if ($exist)
{
echo "OK";
} else {
echo "ERR";
}

mysql_close(); // --> is it important to always close the query?
unset($exist); // --> and unset the unused variables?
mysql_free_result($result); // --> and must free the results?

?>

coz i was used not to close this things.. if their any effect? or negative effect of something?

jatar_k

2:12 pm on Apr 9, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



from
[php.net...]

Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script's execution. See also freeing resources [php.net].

camilord

2:21 pm on Apr 9, 2007 (gmt 0)

10+ Year Member



ok. thanks...