View Single Post
Old 04-06-2008, 12:16 PM   #31 (permalink)
Gurzi
The Visitor
 
Gurzi's Avatar
 
Join Date: Apr 2008
Posts: 3
Thanks: 0
Gurzi is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
There is no single solution. You could include a file which has the database connection code, for one simple solution. If you're writing the same line of code 100 times (or even 50, 10, 5 times!) then you're setting yourself up for problems in the future as has already been recognised (the example of having to edit 100 files just to change the database type).

If you use singleton and you include the database class that opens the connection in multiple different pages i saw that the object is the SAME. how is that possible ( when you define something static this pass through multiple pages ?)

I'm saying this because i used spl_object_hash and it returned the same hash in different pages.

i just included the class with the static object (using singleton).

is this normal ?
Gurzi is offline  
Reply With Quote