On November 13, 2001 12:05 pm, René Fournier wrote:
> Is it true that mixing HTML and PHP--switching back and forth with
> <?php ?>  tags--slows down performance? (I'm using PHP4.) Is it better
> to echo output than to drop out of PHP mode?
>
> And concerning database connections, my ISP asks that I always close a
> MySQL connection with a mysql_close()--which I can understand. But I'm
> curious, if I have to make, say, 10 SELECTs throughout a page (in the
> header, body, and footer), is it perhaps faster to use the mysql_close()
> at the very end of the page (in the bottom of the footer.inc)? In other
> words, is there any disadvantage performance-wise (or stability reason)
> to open and immediately thereafter close mysql connections?
>
> Can anyone recommend an article or two on coding techniques for
> improving PHP and MySQL performance? I don't wan to spend the rest of my
> life optimizing my php code, but if I knew a few basic rules about its
> performance characteristics, I might be able to make better decisions
> when coding. Thanks.
>

Actually unless this has been changed, when your php script terminates php 
automatically closes any mysql connections opened with mysql_connect(). Your 
ISP probably could solve this problem on thier end by putting a time_out 
value for mySQL of 60-120 seconds, so no leftover connections will stay (just 
in case).
Your best bet for optimizing mysql would actually be optimizing your queries, 
or consider using less intensive php functions to retrieve mysql data such as 
mysql_fetch_row & mysql_fetch_obect


Prottoss
[EMAIL PROTECTED]
ICQ: 23361082
http://mediaminer.org/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to