The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Counting Bans Problem - Won't Show
Well I created my own page, /ban.php and I created a template for it.
The problem is, in the php file I have this Code:
// Count the total bans $totalbans = $db->query_first_slave(" SELECT COUNT(userid) FROM userban "); I've run the query in phpmyadmin and it works fine and returns 45. The problem comes when I'm using my template, I use this Code:
Total Bans: $totalbans Thanks in advance. |
#2
|
||||
|
||||
Quote:
Code:
// Count the total bans $totalbans = $db->query_first_slave(" SELECT COUNT(userid) AS bans FROM userban "); The method query_first_slave returns the first row as an array - even if there is only one element. |
#3
|
|||
|
|||
Ah, didn't work ;-( I tried like 50 different codes last night. Well now I'm glad the code is right but tere is something wrong. It doesn't display the number.
My msn is twolvesfan624@msn.com and aim is twolvesfan369, I think my problem lies with something else. Treat be as a noob to this. I think I'm forgetting a vital step. By the way I used this tutorial to create a new page. https://vborg.vbsupport.ru/showthrea...+your+own+page Edit, so here is my php code Code:
<?php // ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE); // #################### DEFINE IMPORTANT CONSTANTS ####################### define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'ban'); // change this depending on your filename // ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array( ); // get special data templates from the datastore $specialtemplates = array( ); // pre-cache templates used by all actions $globaltemplates = array( 'BAN', ); // pre-cache templates used by specific actions $actiontemplates = array( ); // ######################### REQUIRE BACK-END ############################ require_once('./global.php'); // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### $navbits = array(); $navbits[$parent] = 'Ban Page'; $navbits = construct_navbits($navbits); eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('BAN') . '");'); // Count the total bans $totalbans = $db->query_first_slave(" SELECT COUNT(userid) AS bans FROM userban "); ?> Code:
$stylevar[htmldoctype] <html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]"> <head> <title>$vboptions[bbtitle]</title> $headinclude </head> <body> $header $navbar <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tr> <td class="tcat"><center><h1>BAN LIST</h1></center></td> </tr> <tr> <td class="alt1"> <center>$vboptions[bbtitle] Ban Statistics</center> Total Bans: $totalbans[bans] </td> </tr> </table> $footer </body> </html> |
#4
|
||||
|
||||
Quote:
Code:
eval('$navbar = "' . fetch_template('navbar') . '";'); eval('print_output("' . fetch_template('BAN') . '");'); |
#5
|
|||
|
|||
Quote:
Edit: How can I display an array? IE: Display all the ban id's and say the reason. |
#6
|
|||
|
|||
for anyone who doesnt know, this is what he wants to do
http://forums.facepunchstudios.com/showbans.php? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|