MODX3 How to get the db table prefix?

Hello,

how can I get the database table prefix?
I dont find anything…

thank you in advance.

bye
Chris

Hey @fritzkola

You should be able to find your table prefix in:

Manage / Reports / System Info:

image

Thank you very much.

I have to be more specific.

I need the prefix value in snippet.

1 Like

There may be more elegant ways to do this but I think this should work:

<?php
include 'core/config/config.inc.php';
echo $table_prefix;

Someone more knowledgeable than me might be able to comment on the security of this method.

thank you.
ok, this is a solution.

I tried some, but I remember there should be indeed a more elegant way.

:see_no_evil:

$modx->getOption('table_prefix');
1 Like

yes, thats it.

thank you so much. :pray: :pray:

1 Like