vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I display a result of a query? (https://vborg.vbsupport.ru/showthread.php?t=109145)

Nullifi3d 03-01-2006 11:06 PM

lol, you have to put:
$variable['id'], $variable['name'], $variable['url'], $variable['description'] in your template (site_test). $variable['id'] would display the mysql field id as do the other variables have the sam operation.

and with the query you need to change tablename to your mysql table name. ANd change 1 to a valid mysql field (i think this would be id, name, description, or url).

DrewM 03-02-2006 07:12 PM

I get this error when I save the templeat:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/rdsx667/public_html/forum/includes/adminfunctions_template.php(3537) : eval()'d code on line 18

Nullifi3d 03-02-2006 08:10 PM

Just to let you know. it's extremly hard for peole to help you if you don't post the code you're using when you list errors. When asking for help try to list the error and your code.

Remove the ' from the variables when putting them in vbulletin templates.

DrewM 03-02-2006 08:55 PM

sorry about this I'll try removing ' from it though.
It works with this thank you for the help.

on more question and I'm done how do I make the code repeat for the resaults?

Nullifi3d 03-03-2006 01:46 AM

you mean print the results for each row in the table?

DrewM 03-03-2006 09:45 AM

yes, help much apprictated

Nullifi3d 03-07-2006 10:26 PM

PHP Code:

$rows $db->query_read("SELECT * FROM " TABLE_PREFIX "tablenamehere");
while (
$row $db->fetch_array($rows)) {
    eval(
'$rowbits .= "' fetch_template('templatenamehere') . '";');


Replace 'tablenamehere' with the name of the table which has the rows you want to print out. Replace 'templatenamehere' with the name of the template you want printed for every row in that table. Obviously you have to create a new template (templatenamehere). This template will be printed to the browser (eval'd) over and over again for each row in the table (tablenamehere). In the template you put your html and variables you want displayed for each row.

DrewM 03-07-2006 10:29 PM

thanks for the help it is much apprcated.

Nullifi3d 03-07-2006 10:35 PM

No prob, glad to help.


All times are GMT. The time now is 02:31 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.01452 seconds
  • Memory Usage 1,726KB
  • 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)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete