Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passing mysqli object to classes.

2 views
Skip to first unread message

Skipi Skipiorz

unread,
Feb 26, 2010, 5:21:51 PM2/26/10
to
Howdy.

I've got some issue and don't think i can handle it myself. So, I'm
making CMS and dont really know how to deal with mysqli database
object. For instance, shall i do it this way:

global $db;
class foo {
public function __construct() {
$db->query ...
}
}

Or create each time new object:

class foo {
public function __construct() {
$db = new mysqli(...);
$db->query..
}
}

I'd like to use 1st way, it's much faster, however is that safe?

Yours sincerely skipi.

0 new messages