Reply to Re: Declare variable as superglobal?

Your name:

Reply:


Posted by Oliver Gr�tz on 08/24/05 17:52

Super Mango schrieb:
> Great! The "define" did it.
>
> Any Idea for the cases that I want to use a variable after all (for
> counter or for mysql connection)?

Good you elaborate on that?

For example, I hide the connecting stuff from everyday code. Looks
something like this:

class MySQL
{
private static $connection=null;
protected static function connect()
{
if (self::$connection != null) return;
self::$connection=mysql_connect('bla','blah','bla');
// read from config...
}
public function query($sql)
{
self::connect();
return mysql_query(self::$connection,$sql);
}
}

In my everyday code I just have to

$result=MySQL::query('SELECT * FROM test');

No explicit connecting required. Of course you can go for functions but
I'm all for the OOP way (even if it's just static stuff like here).

AllOLLi

[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

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