I have a small famous quote table in my vb4 database. I want to get one quote randomly from the database, and post it on forumhome. so here is what i did.
I put this code in a plugin. and put
$rand_quote in my
forumhome template, but It doesn't work. I've tried to changed the hook location. global_start/complete/forumhome start/complete.
What did I do wrong here. Thanks
PHP Code:
$result = $vbulletin->db->query_read("SELECT quote FROM db_name AS t1 INNER JOIN ( SELECT ROUND(RAND() * (SELECT MAX(id) FROM db_name WHERE live = '1')) AS id ) AS t2 ON t1.id >= t2.id ORDER BY t1.id ASC LIMIT 1;");
while($r = $vbulletin->db->fetch_array($result)){
$rand_quote = "$r[quote]";
}