I know a few apps that do something like:
Code: Select all
DEFINE("UserTable", $prefix . "_users");
...
$db->query("SELECT * FROM " . UserTable . " WHERE id=1");I usually do things differently with a CONFIG item to hold the global config for the site. Still almost the same as above, just doesn't use DEFINE(). When it came across to me, would it be bad to add in a "pattern" to the SQL query itself, so that it uses pattern matching to decide the table name instead of defines/config in the query itself? IE:
Code: Select all
$config['tables']['user_table'] = "users";
...
$db->query("SELECT * FROM {tables[user_table]}");Mostly just a rant about an idea that I had.