Manual talk:$wgDBprefix

From mediawiki.org
Latest comment: 14 years ago by MaxSem

I've been trying to use $wgDBPrefix in an extension I'm writing. First extension, newbie. Anyway, I added a new table to the database and added a couple of functions to manipulate it... they shouldn't affect anything else.

Problem: In the functions I attempt to use $wgDBPrefix to build the table names so that the code won't be hard-wired to my database. In one function, $wgDBPrefix returns (holds) the 3-letter prefix as expected. In another function, it returns not the prefix, but the name of the database. Can't figure out how or why this is getting munged... I'm not touching it. Thoughts? — Preceding unsigned comment added by Guillon (talk • contribs)

Don't use that variable directly, there's DatabaseBase::tableName() for that, along with query abstraction functions that do everything automatically: select(), insert(), update(), delete() and so on. Max Semenik 19:06, 13 November 2009 (UTC)Reply