I am trying to display my vbulletin usergroup ids for each user who posts an ad in my photopost classifieds. in doing this I can execute my code based on that usergroup id. I have been working on this for 3 days now and I just can't get it to work.

This is the code on the page that dfines each listing:

                $gallery['hasimage'][$count] = "$catimage";
                $gallery['prodlink'][$count] = "<a href=\"". construct_newppurl( "showproduct.php", array( 'product' => $id, 'title' => $title, 'cat' => $pcat) ) ."\">$title</a>";
                if ($issticky != 99999 ) $gallery['prodlink'][$count] .= "<img src=\"{$Globals['idir']}/sticky.gif\" alt=\"sticky\" align=\"right\" />";
                $gallery['views'][$count] = $views;
                $gallery['rating'][$count] = $rating;

                list( $numstars, $overall ) = get_user_rating( $tuserid );
                $ratingicon = "";
                if ( $numstars > 0 ) $ratingicon = "&nbsp;<img src=\"{$Globals['idir']}/stars-$numstars.gif\" border=\"0\" alt=\"$numstars {$pp_phrase['stars']}\" />";

                $gallery['username'][$count] = "<a href=\"". construct_newppurl( "member.php", array( 'uid' => $tuserid, 'username' => $tuser) ) ."\">$tuser</a>$ratingicon";
                $gallery['userid'][$count] = "$tuserid";

I attempted to use the following query but it just returns the word 'array':

$users = $vbulletin->db->query_read("SELECT membergroupids FROM 1user WHERE userid = '$tuserid'"); 
while($user= mysql_fetch_array( $users )) {
$membergroupid = $user['membergroupids']; 
} 

That very query works perfectly on the "showproduct" page because the userid is constant. I am attempting to get it to work on the "showcat" page, which lists each of the product in that category. I want to display the usergroup beside each listing displayed.

I know I am looking at this all wrong but just can't wrap my head around why everything I have done hasn't worked and now I am reaching out for help. For those interested, my photopost classifieds is integrated with my vbulletin 4 and uses my member tables and registration system.

Thank you to anyone who can help stop me from pulling out what little hair I have left.

This question has been resolved. I am only posting this to prevent anyone who might come across it in the future from attempting to help. (Good thing I looked for help elsewhere since I didn't get any here.)

Would you share your solution, so it may help others in the future?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.