Proper procedure to close mysql queries!
Proper procedure to close mysql queries!
am 22.03.2006 03:55:17 von jusa_98
--0-1395983780-1142996117=:58760
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi,
Just need some mailing list input here, what is the proper way to close a mysql query using PHP.
- What is the proper way to close a php query to mysql if one query is in the file?
- What is the proper way to close a php query to mysql if 2 or more queries is in the file and where do you close it off?
So if I use code here ?> or is that a safe way to do it and does this close the mysql session off or does it timeout after a set period of time?
Or is a better way mysql_close()? Or do both work the same?
Thanks!
J
--0-1395983780-1142996117=:58760--
Re: Proper procedure to close mysql queries!
am 22.03.2006 04:00:53 von Chris
JeRRy wrote:
> Hi,
>
> Just need some mailing list input here, what is the proper way to close a mysql query using PHP.
>
> - What is the proper way to close a php query to mysql if one query is in the file?
> - What is the proper way to close a php query to mysql if 2 or more queries is in the file and where do you close it off?
>
> So if I use code here ?> or is that a safe way to do it and does this close the mysql session off or does it timeout after a set period of time?
>
> Or is a better way mysql_close()? Or do both work the same?
mysql_close closes a database connection.
What do you mean by a php query to mysql ?
If you want to free memory from a mysql query result, mysql_free_result
does that.
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Proper procedure to close mysql queries!
am 22.03.2006 04:07:21 von jusa_98
--0-471418464-1142996841=:45777
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Hi Chris,
Thanks for that, always wondered. So what does just using '?>' do than?
Must close eventually but I am guessing by using that as a close the connection times out after a set period of time and the 'pid' is killed, correct?
J
---chris said---
mysql_close closes a database connection.
What do you mean by a php query to mysql ?
If you want to free memory from a mysql query result, mysql_free_result
does that.
--
Postgresql & php tutorials
http://www.designmagick.com/
--0-471418464-1142996841=:45777--
Re: Proper procedure to close mysql queries!
am 22.03.2006 04:13:36 von Chris
JeRRy wrote:
> Hi Chris,
>
> Thanks for that, always wondered. So what does just using '?>' do than?
>
> Must close eventually but I am guessing by using that as a close the
> connection times out after a set period of time and the 'pid' is killed,
> correct?
If you're using mysql_connect php will close the connection when the
script itself stops (through an exit(), die() or it just completes
normally) as part of it's shutdown procedures (memory cleanups, garbage
collection etc etc).
If you're using persistent connections (mysql_pconnect) it leaves the
connection open for the next process to use, so it lowers the connection
overhead. However it can have other side-effects (see
http://www.php.net/mysql_pconnect for further info).
--
Postgresql & php tutorials
http://www.designmagick.com/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Proper procedure to close mysql queries!
am 22.03.2006 04:30:25 von jusa_98
--0-616428301-1142998225=:74689
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Thanks :)
Chris wrote: JeRRy wrote:
> Hi Chris,
>
> Thanks for that, always wondered. So what does just using '?>' do than?
>
> Must close eventually but I am guessing by using that as a close the
> connection times out after a set period of time and the 'pid' is killed,
> correct?
If you're using mysql_connect php will close the connection when the
script itself stops (through an exit(), die() or it just completes
normally) as part of it's shutdown procedures (memory cleanups, garbage
collection etc etc).
If you're using persistent connections (mysql_pconnect) it leaves the
connection open for the next process to use, so it lowers the connection
overhead. However it can have other side-effects (see
http://www.php.net/mysql_pconnect for further info).
--
Postgresql & php tutorials
http://www.designmagick.com/
--0-616428301-1142998225=:74689--