Log in

View Full Version : Querying the Database


Reven
09-21-2005, 04:44 PM
I asked over at vBulletin.com's forums (here (http://www.vbulletin.com/forum/showthread.php?t=155261)) and was directed here for custom modifications.

I'm trying to do a custom member map for my forums, but I can't get round this.

I want to query a table I've made in the database which contains information about the members' locations, but I can't figure out how to do it. I've made a raw PHP file which calls the template I've made.

Do I have to call from another PHP file by means of include(), or is there an easier way?

Does it have anything to do with Replacement Variables?

Thanks in advanced.

Marco van Herwaarden
09-21-2005, 04:56 PM
this will depend on a lot of things, for example are you going to retrieve just 1 record, or more. Are you including global.php to make vB functions available?

Easiest would be if you posted the script you got until now.

Reven
09-21-2005, 05:12 PM
I've not written a script yet, as I don't know where to start with this. I can do all the querying stuff fine in PHP, but the problem I have is where to put the actual PHP code that queries stuff from the database. It will include the vB template, so I'll have all the usual global.php stuff and navbars etc.

Basically, do the custom query codes have to go within a [do] function, like this:
if ($_REQUEST['do'] == "blah blah")
{
do certain query;
}

Do they go somewhere else, such as a template bit (I've found one called 'PHP Include Templates', is this where I assign variables to my queries?), or do they have to be embedded in the actual php file?

Sorry if this is confusing.

NB. I've not yet upgraded my board to 3.5.0 RC X from 3.0.8, we're waiting for the Gold version, but I've read about Hooks and Plugins - does this allow you to specify custom PHP code and have it called from a custom php file?