PDA

View Full Version : Total number of messages on a non vb page


Sharg
03-15-2002, 01:05 PM
Hi, i'm looking for a way to include ONLY the total number of messages on a non vb page.

If you know how, please tell me or maybe you could redirect me to a hack that already does it. (I couldn't find one).

Thanks,

Sharg
03-18-2002, 02:21 PM
C'mon please, two views on this request !!!

Sharg

Logician
03-26-2002, 12:06 PM
You can do that with WebTemplate Hack if you create a WebQuery for this. (Check my sig.)

If you need a simple solution (and non-hack solution), you have to create your non-vb page in PHP and then add a SQL query to count db messages and post it in the relevant part of your page. This will be no hack, just another script which makes queries in your vb. db.

Sharg
03-26-2002, 05:01 PM
{quote]If you need a simple solution (and non-hack solution), you have to create your non-vb page in PHP and then add a SQL query to count db messages and post it in the relevant part of your page. This will be no hack, just another script which makes queries in your vb. db.
[/quote]

Well this is in fact exactly what I want to do thanks.
Do you know how I could do it ?

Thanks,
Sharg

Logician
04-03-2002, 07:50 AM
Originally posted by Sharg
Well this is in fact exactly what I want to do thanks.
Do you know how I could do it ?


Well you have to code the script in PHP. ;)

If you need help in a certain part just ask, but besides writing the whole script for you how can someone help you else? :knockedout:

This is the best part of using a hack. You dont need to code it yourself, someelse already coded for you. ;)

Sharg
04-03-2002, 09:07 AM
Well I think its not a whole script but just a line or two of codes....

Thanks,
Sharg

Logician
04-05-2002, 07:30 AM
Originally posted by Sharg
Well I think its not a whole script but just a line or two of codes....

Thanks,
Sharg

Every program is just a few lines code but it takes time not to write it down but to "code" it and debug it.

Anyway I dont like people leaving unanswered so here you go ;)

-- cut --
<table width="100%" border="0" cellspacing="1" cellpadding="00">
<?php
## Hostname or IP of your server where MYSQL database resides.
$servername='localhost';

## Username and password to log onto your MYSQL database server
$dbusername='aaaa'; //MYSQL username
$dbpassword='pppp'; //MYSQL password

## Name of the MYSQL database that vbulletin data exits.
$dbname='dddd';

## Location of your forum. Dont forget the trailing /
$forumlocation="http://www.yourdomain.com/forum/";


mysql_connect("$servername", "$dbusername", "$dbpassword") or die("Couldnt find MYSQL!");
mysql_select_db("$dbname") or die ("Couldnt find DB!");
$cekilen_mesleki=mysql_query("
select threadid, title, postusername, postuserid, dateline
from thread WHERE
visible= '1' AND forumid='15'
order by dateline DESC LIMIT 10
");
if (mysql_error()) {echo "mySQL error:"; echo mysql_error(); exit;}
$mesleki_number=mysql_numrows($cekilen_mesleki); //number of news fetched
if ($mesleki_number<=0) {echo "<tr><td bgcolor=\"#000000\">No New Threads!</td></tr>";}//no news on database!
else {
$ii=1;
while ($gelen= mysql_fetch_row($cekilen_mesleki))
{
if ($ii % 2) {$tdcolor="#FFFFFF";} else {$tdcolor="#eeeeee";}
echo '<td><td bgcolor="'.$tdcolor.'">'.date("Y-m-d", $gelen[4]).' : <a href="'.$forumlocation.'showthread.php?s=&threadid='.$gelen[0].'">'.$gelen[1]."</a> - ".$gelen[2]."</td></tr>";
$ii++;
}

} //else kapa parantez
?>
</table>
-- cut --

This is a sample which gets latest 10 threads of a specific forum and list it in a table.

By changing the query you can list/get any result you want..

Enjoy..