View Full Version : Display Popular Threads on my PHP Website
mixx941
12-20-2003, 01:00 AM
Hi everyone. I'm currently working on perfecting a new layout for my site, and I'm wondering if there is a PHP component or something pre-made to display popular threads on my site.
I'm looking for something fairly small, that would fit in the right cell of the middle table here:
http://www.mixx941.com/index.php
Thanks in advance.
filburt1
12-20-2003, 02:17 AM
Depends on how you define popular. If you mean number of views:
SELECT title, threadid, views FROM thread ORDER BY views DESC LIMIT 10;
Or number of replies:
SELECT title, threadid, replycount FROM thread ORDER BY replycount DESC LIMIT 10;
mixx941
12-20-2003, 03:09 AM
Thanks for your reply.
However, I do not know exactly what you mean by that code. I know those are SQL queries that should be put in phpMyAdmin, but how would I get it to display on my page, and what database would I put it in, etc?
Thanks
mixx941
12-20-2003, 03:22 PM
Okay, I've run those queries on a copy of my vBulletin database...and it gave me this PHP code back:
<?php
$sql = 'SELECT title, threadid, replycount';
$sql .= 'FROM thread';
$sql .= 'ORDER BY replycount DESC ';
$sql .= 'LIMIT 10 ';
?>
I tried to put that on my PHP page just to see, and it didnt work. How do I make it connect to my database, or is there anything else I'm missing?
Thanks.
shorty
12-21-2003, 10:14 AM
You would need to setup a connection to your Vbulletin database, so you could execute that query :)
Are you running another database for your normal page PHP?
mixx941
12-21-2003, 01:11 PM
No. It's just straight PHP pages with no database involved.
Thanks in advance.
shorty
12-21-2003, 02:11 PM
Check your PMs :)
I can help you quicker on instant messenger.. if you have it :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.