Hi Markus,

I've only seen the last couple messages from this thread, but to my
knowledge PHP doesn't close the MySQL connection at the end of each block.
It will close the connection automatically once the entire PHP script has
finished processing, though, if you haven't.

I prefer not to intermingle my HTML code with PHP code, but have not found
any performance problems if you do.

But in any event, here are a couple of options if you choose not to switch
from PHP code to HTML and then back again via the <?  ?> syntax:

1. Use the "here" syntax:

print <<<EOS
<HTML>
<TITLE>$PHP_SELF</TITLE>
</HTML>
EOS;

2. Just create your HTML string in PHP and then output it:

$html_string = "<HTML>
<TITLE>$PHP_SELF</TITLE>
</HTML>";

print $html_string;

If I'm missing the point or have oversimplied it, my apologies.

Best regards,
-Joe

> -----Original Message-----
> From: markus|lervik [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 13, 2001 1:30 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP] Performance
>
>
> On Thu, 2001-12-13 at 22:16, Ron Jamison wrote:
> > I'm fairly sure there's no difference in performance when using PHP
> tags
> > mixed with HTML blocks as you are doing.
> >
> > Think of it as PHP knowing that it should send everything
> not in <? ?>
> tags
> > directly to the browser.  Like an echo or a print, but
> without needing
> to
> > specify calls to those functions.
> >
> > <HTML>
> > <? echo $PHP_SELF ?>
> > </HTML>
> >
> > <HTML>
> > <?=$PHP_SELF?>
> > </HTML>
>
> I'm not -that- worried about performance loss for switching between,
> php and html, what annoys me (and would probably slow down performance
> quite a bit), is that every time I have to do a database query, I have
> to use mysql_connect again, because as Prottoss pointed out, PHP drops
> the connection every time a PHP-block ends.
>
> Not that it is that a big issue for my particular application, but
> knowing a workaround to this problem would be quite useful in the
> future.
>
>
>
> Cheers,
> Markus
>
> --
> Markus Lervik
> Linux administrator with a kungfoo grip
> Vasa City Library - Public Library
>


---------------------------------------------------------------------
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