MyBB Community Forums

Full Version: SQL Queries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I can't figure out how to do a query in the MyBB system.
I would like to pull the title column from the usergroup table.
And then I would like to echo the result, like a usergroup legend, but I want to basically do it by myself.
Although, I can't figure out how to do a query.
So, can anyone help?
Thanks.

Edit:
Also, what would I use to send a person a PM?
Like after a registration.
Queries would be done from phpmyadmin or something similar.
http://community.mybb.com/thread-76623.html

One like this, just with usergroups..

Bump.
Quick example:

$get_groups = $db->query("SELECT title FROM ".TABLE_PREFIX."usergroups WHERE gid =X");
$groups_result = $db->fetch_array($get_groups);
$end_result = $groups_result['title'];
print $end_result;

Replace X with the usergroup.

It would print this:

http://mfgaming.us.to/test.php

(Spiders & Bots is my custom group, GID 9)
Better off using the cache which has the usergroups data already in it.
Bump.
Well you have 3 options suggested.
Cache (Quick but can be outdated as all caches can be)
DB query (Standard easy php stuff)
or Simple select (A little MyBB function that people sometimes use in plugins).