Re: mySQL overhead: Tweaking Scripts for Speed
| From: | CPT John W. Holmes | Date: | Fri, 05 Sep 2003 17:03:07 +0000 |
| Subject: | Re: mySQL overhead: Tweaking Scripts for Speed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161783@lists.php.net to get a copy of this message | ||
From: "Dan Anderson" <dan@mathjunkies.com>
> But how much overhead is there in:
>
> $link = mysql_connect($hostname,$username,$password) or die("");
> $db = mysql_select_db($database,$link) or die("");
>
> Would it be beneficial to run a single one at the beginning of every
> script? Currently I have a bunch of functions each with their own
> calls.
You should only "connect" once in your script. It's usually in an include
file to make things easy.
While multiple connections will just return the first connection, anyhow,
why do the extra work, right?
---John Holmes...