0

I'm building a small plugin for EE and I need to retrieve the name of the database. ( specified in config > database.php )

But I can't seem to find any docs that point me in the right direction.

1 Answer 1

2

The docs say that Database Class is initialized automatically.

A var_dump(ee()->db) show us that the name of database can be retrieved by, on EECMS 2.6+:

ee()->db->database

And on EECMS 2.5.5-:

$this->EE->db->database
3
  • seems reasonable :) where did you find this ?
    – janvl
    Commented Jun 3, 2013 at 16:45
  • I improved my answer, @janvl. Please, forgive me.
    – Sobral
    Commented Jun 3, 2013 at 17:16
  • ah, no problem Robson, I was just wondering where you found it, so I don't have to trouble you guys with silly questions like these in the future.
    – janvl
    Commented Jun 3, 2013 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.