I already have some tables in my database that are the same as drupal eg. access is in use by my vBulletin and so are some others. Is there a way i can change it to have a main_ at the start of each prefix and also not have any errors on my site?

Comments

fuzzygroup’s picture

I know that when you install phpbb, it asks you for a tablename prefix which it then establishes as a constant for all SQL table name references. This is good for low end hosting situations where you often have only a single DB. Here's a modified version of how I do it in my code.

// UPDATE THIS HERE
// prevents namespace collisions w/ existing tables
// note that tihs is optional and will generally be left blank
$table_prefix = "";

// CONSTANTS START HERE
// db table names
// the core message data
define('EMAILS', $table_prefix.'fo2_emails');

and then when I reference a table in my sql, it becomes:

"SELECT subject, accountaddress FROM " . EMAILS . "WHERE subject = 'XYZ' ";

NOTE: I'm not saying that this helps you at all but that it's a good idea for the future of Drupal.

gene@csof.net’s picture

I have a little (read: tiny) hosting company I run off a single debian server that I can set you up on and I'll happily give you a half dozen dbs if you want (with phpmyadmin access)... email me at genem_at_cascadehosting_dot_com if you're interested.

Apps sharing the same db is scary, but the other comment here seems like a good tip if you aren't up for switching hosts.

killes@www.drop.org’s picture

barryorourke’s picture

I used db_prefix a while back when I was experimenting. There appears to be a few problems with it in relation to a few a the newer tables...