Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 11:15:56 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155404 Posts in 21698 Topics by 7730 Members
Latest Member: anybig0391d
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: a question about the global valuriable  (Read 450 times)
faquir

Offline Offline

Posts: 49



« on: July 14, 2008, 04:28:59 PM »

when I read some thread about the latest new section, I found a very interesting part is

global $database;

$result = $database->query($query);
$total = $result->numRows();   

I can not understand this coding writing, which I think it should be,

$database = new database();

then can access the methods in the database class.

could someone explain to me that, global $database; is the other way new a class?

Thanks.

Logged
faquir

Offline Offline

Posts: 49



« Reply #1 on: July 15, 2008, 03:46:42 PM »

is that wrong place I post?
Logged
pcwacht
AddOn Development
*
Offline Offline

Posts: 2855



WWW
« Reply #2 on: July 15, 2008, 06:26:50 PM »

Not the wrong place, I think Wink

What I understand, and maybe I am wrong as well

By declaring the $database as global the allready existed $database is used so no new instance is needed.

Look at her for more info http://nl.php.net/global


Have fun,
John
Logged

http://www.ictwacht.nl = Dutch ICT info
http://www.pcwacht.nl = My first
both still work in progress, since years.....
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!