RaidenDAWG2
08-08-2005, 10:36 AM
I'm working on a major game development project (fully vB integrated) for my site, and I'm having a problem getting a couple of functions to work.
The first one here fetches the info for a given team. I did some testing (echoed variables), and I found that while the $userid variable was set properly, the query following it wasn't functioning as designed (i.e. it returns nothing).
function fetch_teaminfo($userid, &$teaminfo)
{
global $vbulletin;
//requires that is an actual owner.
$userid = intval($userid);
$teaminfo = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."fwteams WHERE ownerid = $userid");
}
Second one works on determining if the user is a team owner or GM (haven't implemented the second half yet, so it by default returns 0 for false).
function check_status($userid, $docheckon)
{
global $vbulletin;
$userid = intval($userid);
if($docheckon == 'owner')
{
$yayornay = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."fwowners WHERE ownerid = $userid");
if($yayornay == '1')
{
return 1;
}
else
{
return 0;
}
}
if($docheckon == 'gm')
{
return 0;
}
}
Again, did some testing on this, the $userid is set, but for some reason the query's not functioning.
Sorry if these are stupid questions guys. Haven't exactly had any formal training in MySQL or PHP, been basically learning on my own for the last two months or so (have experience with Java and RESOLVE/C++) through trial and error.
Thanks for any help :)
EDIT: Should mention, all of the above is programmed for 3.5 RC1
-RD
The first one here fetches the info for a given team. I did some testing (echoed variables), and I found that while the $userid variable was set properly, the query following it wasn't functioning as designed (i.e. it returns nothing).
function fetch_teaminfo($userid, &$teaminfo)
{
global $vbulletin;
//requires that is an actual owner.
$userid = intval($userid);
$teaminfo = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."fwteams WHERE ownerid = $userid");
}
Second one works on determining if the user is a team owner or GM (haven't implemented the second half yet, so it by default returns 0 for false).
function check_status($userid, $docheckon)
{
global $vbulletin;
$userid = intval($userid);
if($docheckon == 'owner')
{
$yayornay = $vbulletin->db->query_read("SELECT * FROM ".TABLE_PREFIX."fwowners WHERE ownerid = $userid");
if($yayornay == '1')
{
return 1;
}
else
{
return 0;
}
}
if($docheckon == 'gm')
{
return 0;
}
}
Again, did some testing on this, the $userid is set, but for some reason the query's not functioning.
Sorry if these are stupid questions guys. Haven't exactly had any formal training in MySQL or PHP, been basically learning on my own for the last two months or so (have experience with Java and RESOLVE/C++) through trial and error.
Thanks for any help :)
EDIT: Should mention, all of the above is programmed for 3.5 RC1
-RD