Log in

View Full Version : forumhome_start


sheppardzwc
12-03-2009, 04:56 AM
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:

$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!
$result = $vbulletin->db->query("query");
// and not
$query = "query");
fetch_array($query); // ;)



try this:

$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
you don't run the query;) quote_sql is a string and not a query!
$result = $vbulletin->db->query("query");
// and not
$query = "query");
fetch_array($query); // ;)



try this:

$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!"