vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Mod help (https://vborg.vbsupport.ru/showthread.php?t=220177)

pein87 08-04-2009 02:17 PM

Mod help
 
I/m working on a mod and I posted in the wrong section. What I'm trying to do is get the socialgroup leader, and member count from the socialgroups and then display them in an small div based layout on a new page. Its for RPG on my site. I was wondering how to go about doing this as my code didnt display anything.

PHP Code:

$groupInfo $vbulletin->db->query_read("SELECT socialgroupcatagoryid, name, creatoruserid, members FROM "THREAD_PREFIX" `socialgroup`");
$groupArray $vbulletin->db->fetch_array($groupInfo);
$groupLeader $groupArray['creatoruserid'];
$groupMembers $groupArray['members'];
sprintf($groupLeader);
sprintf($groupMembers); 

I added that to a template to see if it would work and it didnt. I want to only display them if there in a certain catagory and have them show the creators user name and member count. I tried to add the code into the php file but I got DB errors saying databaseName.thread_prefix does not exist.
I wanted to create a tag/badge for each group showing there leader and member count while haveing the images look difrrent based on the groups name.

Lynne 08-04-2009 02:41 PM

Usually when you do a fetch_array, you are looking to get more than one line back from the query, otherwise you would do a query_first. Are you trying to get one thing back or many? If many, you should put your fetch_array in a while loop (you can do a search on 'fetch_array' in the vb code and you'll find many examples).

pein87 08-04-2009 10:03 PM

I'm trying to only get the name, the catagory id of the social group, the creators id and the member count of the group. I would do query_first instead? Would I apply it to the php script or to the template like in my example?

Lynne 08-04-2009 10:22 PM

If you are only trying to get one row returned, then replace query_read with query_first and then you don't need the fetch_array line (query_first will fetch the variables also).

pein87 08-05-2009 02:36 PM

Thanks but would I add it to a template or to the php file itself?

Lynne 08-05-2009 02:57 PM

You cannot put php in a template - all php must go in the page or a plugin.


All times are GMT. The time now is 03:47 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03122 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete