Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Any php code to extract these?
I would like to include some inline stats on another web page and was wondering if there is any php code I can use to present the following:
1. number of vanilla users
2. total number of discussions
3. total number of comments
1. number of vanilla users
2. total number of discussions
3. total number of comments
0
This discussion has been closed.
Comments
Nr of discussions: SELECT COUNT( * ) FROM `LUM_Discussion` ;
Comments: SELECT COUNT( * ) FROM `LUM_Comment` ;
Users: SELECT COUNT( * ) FROM `LUM_User` ;
Now, if you want to call this outside of vanilla. what you need to do is connect to the database and run these queries, like this:
mysql_connect("[host]","[user name]","[password]") or die(mysql_error()); mysql_select_db("[database name]") or die (mysql_error()); $result= mysql_query("SELECT COUNT( * ) FROM `LUM_Discussion` ;") or die (mysql_error()); $row = mysql_fetch_array($result); $nr_of_discussions = $row[0]; $result = mysql_query("SELECT COUNT( * ) FROM `LUM_Comment` ;") or die (mysql_error()); $row = mysql_fetch_array($result); $nr_of_comments = $row[0]; $result = mysql_query("SELECT COUNT( * ) FROM `LUM_User` ;") or die (mysql_error()); $row = mysql_fetch_array($result); $nr_of_users = $row[0]; echo "Discussions: ".$nr_of_discussions." | Comments. ".$nr_of_comments." | Users: ".$nr_of_users;
SELECT COUNT(*) FROM ".$Context->Configuration['DATABASE_TABLE_PREFIX']."Comment WHERE ...