MyBB Community Forums

Full Version: How to get current database tablename/table prefix?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone. Smile

How can I get the current database table name and prefix?
Do you mean you want to get the table prefix name, like this:

tableprefix_users ?


If that is correct, you can use the TABLE_PREFIX code.
TABLE_PREFIX
(2012-07-25, 04:13 PM)Vernier Wrote: [ -> ]Do you mean you want to get the table prefix name, like this:

tableprefix_users ?


If that is correct, you can use the TABLE_PREFIX code.
TABLE_PREFIX

Correct, I'm guessing that is a PHP constant? Thank you for your help.
What are you trying to do with it?

For example, if you're running a query, you'd use something like this:

$db->query("UPDATE `".TABLE_PREFIX."users` SET email='1' WHERE uid='1'");