Reply to Re: scope of mysql connections with multiple php snippets

Your name:

Reply:


Posted by Erwin Moller on 03/23/07 15:20

dino d. wrote:

> hi everyone-
>
> if i have a simple question- if i open a database connection in one
> snippet of php, can i use it in a subsequent snippet in the same php
> file:
>
>
> <html>
> <head>
> </head>
> <body>
> ...
> <?php
>
> //open database here
>
> ?>
>
> //more html
>
> <?php
> //now use open database
>
> ?>
>
>
> i thought this should work but i'm getting errors. thanks for any
> help.
>
> dino

Hi,

Should work.
If you didn't close the connection, it is still available later in the SAME
script.
When PHP reaches the end of the script and stops, it automagically closes
the connection for you.

You must have some other issue going on in your script.
Maybe it helps if you post a real example, so we can see what you are really
doing.

Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация