You are here: Re: how to make a database connection available to all pages? « PHP Programming Language « IT news, forums, messages
Re: how to make a database connection available to all pages?

Posted by Jerry Stuckle on 06/26/05 23:52

ndsoumah@gmail.com wrote:
> 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?
>

I always close the connection myself. However, it should be closed at
the end of the script.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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