Reply to Re: how to make a database connection available to all pages?

Your name:

Reply:


Posted by Tony Marston on 06/27/05 11:14

<ndsoumah@gmail.com> wrote in message
news:1119809399.642107.214020@f14g2000cwb.googlegroups.com...
> ok. basically are telling me to do something like this:
>
> function establishConnection ()
> {
> if ( !$connection = @mysql_connect("localhost","root") )
> die ("Echec de la connection");
>
> // Je selectionne la base de donnees
>
> if ( !(@mysql_select_db("djoubarn_Emploi",$connection)))
> showerror();
> return $connection;
>
> }
>
>
> then save this routine in an include file and call it on every page?
> if so , it doesn't matter that the database was never closed?

Just because you do not explicitly close the database connection does it
remain open. When the PHP script terminates all resources are closed
automatically. However, it is good programming practice to close a
file/connection when you have finished with it.

--
Tony Marston

http://www.tonymarston.net

[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

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