Log in

View Full Version : Quick Database Stats


assassingod
04-18-2003, 10:00 PM
Quick Database Stats

Author: assassingod

Description: This hacks gives a quick list of database stats for your forums. Includes name and ammount of MB its using.

Credits: Sebastian

Screenshots:
https://vborg.vbsupport.ru/attachment.php?s=&postid=431944


Tested on vB version:
2.3.2
2.3.0
2.2.9

If you use this hack please click the INSTALL (https://vborg.vbsupport.ru/misc.php?s=&action=install&threadid=51828) button - thank you!

Chris M
04-19-2003, 04:53 PM
Nice:)

Satan

Zelda-King
04-19-2003, 05:28 PM
I installed it but it says; Database Stats gamercrossfire_net (Using ERROR! MB of space) :/

assassingod
04-19-2003, 05:35 PM
There are some comments on line 5 and 7

Try following those instructions and see if it works:)

amykhar
04-19-2003, 05:43 PM
I ended up having to hard code in my username and password to get it to work. The localhost line didn't have to change for me though.

Amy

assassingod
04-19-2003, 06:07 PM
Maybe I should have kept 'require("./config"); '?
I'll test it out

Zelda-King
04-19-2003, 06:41 PM
I'm fine now. I neglected to look for configurables. Sorry about that!

assassingod
04-19-2003, 06:44 PM
Glad to here its working:)

yxboom
04-20-2003, 04:57 AM
Working fine.

Boofo
04-20-2003, 05:34 AM
When I hard-coded my username and password in, this is the error I got:

Warning: mysql_query(): 5 is not a valid MySQL-Link resource in /home/bear/public_html/forum/admin/db_mysql.php on line 86

If I don't hardcode it, it get the line

(Using ERROR! MB of space)

gmarik
04-20-2003, 07:57 AM
Nice, nice, nice!

assassingod
04-20-2003, 09:46 AM
Today at 06:34 AM Boofo said this in Post #11 (https://vborg.vbsupport.ru/showthread.php?postid=384498#post384498)
When I hard-coded my username and password in, this is the error I got:

Warning: mysql_query(): 5 is not a valid MySQL-Link resource in /home/bear/public_html/forum/admin/db_mysql.php on line 86

If I don't hardcode it, it get the line

(Using ERROR! MB of space)

Did you check the comments on lines 5 and 7?

alkatraz
04-20-2003, 07:46 PM
I get this error arning: mysql_query(): 1 is not a valid MySQL-Link resource in /home/alkatraz/www/board/admin/db_mysql.php on line 93 even after changing all the user/pass/server vars in script.

No worries, I removed the hack anyways. But good idea!

assassingod
04-20-2003, 08:04 PM
Not too sure why you got that error:confused:
Oh well:(

N9ne
04-20-2003, 09:04 PM
Maybe it only works on certain OS's?

assassingod
04-20-2003, 09:07 PM
Maybe - Some say it work some say it dont.

Weird

Kriek
04-21-2003, 02:31 AM
$db = mysql_connect($db_host, $db_usr, $db_pwd) or die (mysql_error());
mysql_select_db($tdb, $db) or die (mysql_error());

mysql_error() (http://www.php.net/manual/en/function.mysql-error.php) will give a more specific error to work with; definitely a life saver for me. Hope this helps.

Boofo
04-21-2003, 02:34 AM
Today at 04:46 AM assassingod said this in Post #13 (https://vborg.vbsupport.ru/showthread.php?postid=384543#post384543)
Did you check the comments on lines 5 and 7?

Yes, I did. When I do it that way, I get some strange db error about a lastpost or something and all of the text on the page suddenly goes to smallfont. Wierd.

Kriek
04-21-2003, 03:16 AM
Today at 03:46 PM alkatraz said this in Post #14 (https://vborg.vbsupport.ru/showthread.php?postid=384758#post384758)
not a valid MySQL-Link resource

$tdb MUST equal your database name.

I'm willing to bet that mysql_error() (http://www.php.net/manual/en/function.mysql-error.php) will return "No database selected" ;)

Sanjiyan
04-21-2003, 05:42 AM
Installed just fine, but how do I shorted the MB feedback?

At the moment it looks like this:

Database Stats borg (Using 1.0523281097412 MB of space)

How do I get it to go to: 1.23 MB

assassingod
04-21-2003, 09:21 AM
Today at 03:34 AM Boofo said this in Post #19 (https://vborg.vbsupport.ru/showthread.php?postid=384957#post384957)
Yes, I did. When I do it that way, I get some strange db error about a lastpost or something and all of the text on the page suddenly goes to smallfont. Wierd.

Do you have anything else installed in your admin CP? I can't think why its doing that.:confused: I'll look into it more

Today at 03:31 AM Kriek said this in Post #18 (https://vborg.vbsupport.ru/showthread.php?postid=384953#post384953)
$db = mysql_connect($db_host, $db_usr, $db_pwd) or die (mysql_error());
mysql_select_db($tdb, $db) or die (mysql_error());

mysql_error() (http://www.php.net/manual/en/function.mysql-error.php) will give a more specific error to work with; definitely a life saver for me. Hope this helps.

Thanks Kriek !!


Today at 06:42 AM Sanjiyan said this in Post #21 (https://vborg.vbsupport.ru/showthread.php?postid=385006#post385006)
Installed just fine, but how do I shorted the MB feedback?

At the moment it looks like this:

Database Stats borg (Using 1.0523281097412 MB of space)

How do I get it to go to: 1.23 MB

I will look into it:)

iwearnosox
04-21-2003, 09:51 AM
This will return the correct DB size after hard coding name and password for me but then it spews out:

Warning: mysql_query(): 1 is not a valid MySQL-Link resource in /path/admin/db_mysql.php on line 86

This error disappears after removing this hack. I have a 2.3 board.

Kriek
04-21-2003, 08:23 PM
iwearnosox, let me break your error down for you ;)

mysql_query() throws an error because $result = mysql_query($sql_result); this can not be run because $sql_result = "SHOW TABLE STATUS FROM " .$tdb; and the $tdb variable MUST contain your database name which is in mysql_select_db($tdb, $db); so the connection is broken, because the $tdb variable is incorrect.

As I've already stated in my previous comments from this thread [1 (https://vborg.vbsupport.ru/showthread.php?postid=384953#post384953)][2 (https://vborg.vbsupport.ru/showthread.php?postid=384976#post384976)] that error is specifically caused because the connection to the database was prevented either in mysql_connect() (http://www.php.net/manual/en/function.mysql-connect.php) or mysql_select_db() (http://www.php.net/manual/en/function.mysql-select-db.php) and using mysql_error() (http://www.php.net/manual/en/function.mysql-error.php) will specifically output the error causing the problem.

iwearnosox
04-21-2003, 08:32 PM
Thanks for the added info. I'm going on no sleep for like 36 hours now so any attempt at a reasonable reply is beyond me. Once I sleep I'll check back in and try to understand what you just said. :)

Kriek
04-22-2003, 11:27 PM
Starbucks coffee and ice cream in a blender does the trick for me.

59 hrs without sleep, hoping for at least 3 hrs soon.

Tungsten
04-23-2003, 02:57 PM
Works great "out of the box" with 2.2.8 running on a Windows 2000 / IIS5 installation.

/me licks install

Sanjiyan
04-24-2003, 12:20 PM
assassingod,

Any luck with narrowing down the number of decimal points I posted a few days ago?

ie 1.23 MB instead of 1.23456789 MB

assassingod
04-24-2003, 02:18 PM
Not yet - If anyone knows too, would you kindly share how to?

Still working on a new version

Boofo
04-30-2003, 02:29 PM
Any luck on the new version?

assassingod
04-30-2003, 02:46 PM
Not as yet no.

Its the next thing on my list i assure you:)

assassingod
05-11-2003, 08:57 AM
REMOVED UNTIL ALL BUGS ARE FIXED

The [real] final version is being worked on now.

assassingod
09-07-2003, 09:35 AM
<font color="red">Updated the v3</font>

This should be a working version. I've tested it and there appears the be NO errors.

Let me now if anything is wrong.

assassingod
09-07-2003, 09:35 AM
Screenshot