PDA

View Full Version : Calling from mySQL


morrow
03-16-2009, 06:28 PM
Hi,

I have some code that I've finally gotten to work the way I want it to. The values are input into a mySQL DB and an XML file.

How would I be able to apply various mySQL values into various locations of VB? For example. I have a value called, "MICKEY MOUSE". I'd like for that value to be displayed somewhere in the navbar or header or maybe even on top of certain forums. How do I make the call from vBulletin into mySQL to get the value then add it to the vbulletin template?

Thanks in advance for your help.

Lynne
03-16-2009, 06:40 PM
You would put the query in a plugin that is used on that page. Something like:

$query = $db->query_read("SELECT something FROM " . TABLE_PREFIX . "sometable WHERE this = $that");

$result = $db->fetch_array($query);
$myvariable = $result['something'];


And then you would use $myvariable in the template.

Dismounted
03-17-2009, 06:01 AM
If you're doing the above (Lynne's post), you can just use query_first(), as it will automatically return an associative array.