vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to display result of sql quire (https://vborg.vbsupport.ru/showthread.php?t=221406)

MozyMac 08-21-2009 11:29 AM

How to display result of sql quire
 
hello,

I have made quire to find number of users in a usergroup and code to display number, but when i add the code to my custom vb page it won't display it:

Code:


<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'imamac'); // 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(
    'imamac',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
 $res = mysql_query("SELECT username FROM user WHERE usergroupid = 2") or die("Error: ".mysql_error());
  $numRows = mysql_num_rows($res); // Here you get the number of rows returned
  echo "There are currently $numRows users";
$navbits = array();
$navbits[$parent] = 'Im a Mac';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('imamac') . '");');


 

?>


Lynne 08-21-2009 03:14 PM

Don't use echo. Assign the results text to a variable and spit the variable out in your template. What is in your template?

MozyMac 08-22-2009 10:52 PM

Quote:

Originally Posted by Lynne (Post 1871678)
Don't use echo. Assign the results text to a variable and spit the variable out in your template. What is in your template?

hmm it's name is imamac

thanks

MozyMac 08-24-2009 07:48 AM

hmm lynne please help me :(

Thanks

Lynne 08-24-2009 02:19 PM

I asked to see what was in your template but you haven't posted it.

Here's an example of what I mean by don't use echo. You have:
PHP Code:

echo "There are currently $numRows users"

You should do it like this:
PHP Code:

$myvar =  "There are currently $numRows users"


And then put $myvar in your template.

MozyMac 08-26-2009 12:10 AM

Quote:

Originally Posted by Lynne (Post 1873401)
I asked to see what was in your template but you haven't posted it.

Here's an example of what I mean by don't use echo. You have:
PHP Code:

echo "There are currently $numRows users"

You should do it like this:
PHP Code:

$myvar =  "There are currently $numRows users"


And then put $myvar in your template.

sorry for not replaying soon :(

Thanks for help :D


All times are GMT. The time now is 11:44 PM.

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.01063 seconds
  • Memory Usage 1,731KB
  • 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_code_printable
  • (4)bbcode_php_printable
  • (2)bbcode_quote_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