Re: How *not* to assume MySQL will return data?
| From: | Jason Wong | Date: | Mon, 13 May 2002 17:48:10 +0000 |
| Subject: | Re: How *not* to assume MySQL will return data? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-97384@lists.php.net to get a copy of this message | ||
On Tuesday 14 May 2002 01:36, Chris Knipe wrote:
> Hmmmm.....
>
> There's no way to do it *without* having to submit two queries to the
> database? I'm thinking load wise here..... The query (or block), would be
> displayed on every single page in my app - sort of like a shared border
> type thing...
>
> Now, when I have say, 20 pages in the site, 250 concurrent users (or active
> sessions) on the site - which, can happy very quickly - the load on the
> database is going to be -very- high.... So I'm kind of looking for a way
> how I can do this, with as few queries as possible, to put as little stress
> on the database as I can...
>
> But yes, if there is no otherway to do it, then I guess this would have to
> do....
It's just a matter of structuring your code properly. Separate code from HTML.
Have your regular while-loop reading all the results into an array. If array
is not empty then print your stuff out, otherwise don't print anything.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
"Virtual" means never knowing where your next byte is coming from.
*/