vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   forumhome_start (https://vborg.vbsupport.ru/showthread.php?t=229406)

sheppardzwc 12-03-2009 04:56 AM

forumhome_start
 
I have 3 variables that I generated from a query that I want to display on the FORUMHOME template, right under the guest welcome box. I keep trying but it's not working.

I have the PHP code to be executed at forumhome_start:

PHP Code:

$quote_sql "SELECT id,author,text FROM " TABLE_PREFIX "quote ORDER BY rand() LIMIT 1";
$quote_result $db->fetch_array($quote_sql);
$quote_sys_author $quote_result['author'];
$quote_sys_text $quote_result['text'];
$quote_sys_id $quote_result['id']; 


But when I try and print out "$quote_sys_id" or "$quote_sys_text," it returns blank. Any help?

ragtek 12-03-2009 06:24 AM

you don't run the query;) quote_sql is a string and not a query!
PHP Code:

$result $vbulletin->db->query("query");
// and not
$query "query");
fetch_array($query); // ;) 


try this:
PHP Code:

$quote_sql $vbulletin->db->fetch_first("select .....); //fetch first because you got just one result back;) 

and then you should have your things in $qute_sql

sheppardzwc 12-03-2009 10:20 AM

Quote:

Originally Posted by ragtek (Post 1924549)
you don't run the query;) quote_sql is a string and not a query!
PHP Code:

$result $vbulletin->db->query("query");
// and not
$query "query");
fetch_array($query); // ;) 


try this:
PHP Code:

$quote_sql $vbulletin->db->fetch_first("select .....); //fetch first because you got just one result back;) 

and then you should have your things in $qute_sql

Oh, ROFL! That's what I get at coding at 3AM. Thank you. :)

EDIT: Works perfectly now, thanks! :D (FYI - the command is query_first, not fetch_first)

Lynne 12-03-2009 01:31 PM

Hehe. This thread gave me a good little chuckle this morning. :)


Lynne writes on note.... "this is why you don't code at 3 am!"


All times are GMT. The time now is 10:25 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.01135 seconds
  • Memory Usage 1,729KB
  • 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
  • (5)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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