I don't know that you are asking the right question--queries don't get closed---they execute, so there is nothing to close. You can close a database connections though. Post some code and what your worries about it are.
there are two ways to connect to mysql. 1. mysql_connect such connections automatically gets disconnected once script execution is over. 2. mysql_pconnect such connections are kept live until time out. when you have to execute many queries in loop, its better to use mysql_pconnect before the loop and use mysql_close after loop is over. it is always good to explicitly close connections - be it mysql or file once its usage is over cleaning up garbage always helps us next time
How can I close this? $result = mysql_query("SELECT * FROM my_table WHERE status = 'ABC'") or die(mysql_error()); if (mysql_num_rows($result) > 0) { While LOOP Here }
Is this correct? $result = mysql_query("SELECT * FROM my_table WHERE status = 'ABC'") or die(mysql_error()); if (mysql_num_rows($result) > 0) { While LOOP Here } mysql_close();