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