cleaning up my connection act
| From: | Larry Linthicum | Date: | Thu, 26 Oct 2000 15:41:41 +0000 |
| Subject: | cleaning up my connection act | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3958@lists.php.net to get a copy of this message | ||
Hi, as my first ever attempt at programming I now have a website "working"
using PHP and MySQL to produce a lot of dynamic content.
My next step is to try and go back, and make the code a little cleaner.
I have never understood ( still don't) the connection(s) to the database
1) should each one be closed ' mysql_close() ' as soon as it has served its
need, or do they automatically close at the end of a script? ( I worry about
overtaxing the server and I really have ZERO idea of how it all works)
2) If I want to make several queries to produce a page, say one as the page
starts loading to get data that is used in the WHERE clause of another at
the bottom of a page, to different tables in the same database. Do I need
to open separate connections for each one? (the PHP is in separate blocks
with straight HTML in-between, if that matters)
anyway I haven't been able to find any documentation I could UNDERSTAND <G>
on connections and how best to use them to not tax the system more than
necessary and would appreciate info on that