Hello people.
I need help from a good coder who knows MyBB well. It won't be hard, It's simple MySQL query but I'm not good at MySQL so I need to ask someone to help me
I need two little scripts.
Thanks if anyone can help me with this. =]
PS/Edit: I'll give a cookie!
I need help from a good coder who knows MyBB well. It won't be hard, It's simple MySQL query but I'm not good at MySQL so I need to ask someone to help me
I need two little scripts.
- A stats script: A simple stats script which returns the total number of threads. topics, users, and forums. I had a script already made by someone on the Code Modifications Forums but they were horrible and outdated. Their script was like this:
<?php $prfx = "mybb_"; // The table prefix of your database $topic_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."threads"); $topic_count = mysql_fetch_array($topic_result); $topic_count = $topic_count["count"]; $post_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."posts"); $post_count = mysql_fetch_array($post_result); $post_count = $post_count["count"]; $user_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."users"); $user_count = mysql_fetch_array($user_result); $user_count = $user_count["count"]; $forum_result = mysql_query("SELECT COUNT(*) as count FROM ".$prfx."forums"); $forum_count = mysql_fetch_array($forum_result); $forum_count = $forum_count["count"]; ?> Stats <table> <tr> <td><b><?php echo $topic_count; ?></b></td> <td>Threads</td> </tr> <tr> <td><b><?php echo $post_count; ?></b></td> <td>Posts</td> </tr> <tr> <td><b><?php echo $user_count; ?></b></td><td>Users</td>
But it's outdated and it's crappy, so all I'm asking is to get it modified and updated please.
- Second, a latest Posts script. A simple script to pull the latest 5 posts made and who made them and when. Again, I used someone else's but it's outdated and sucky, here it is:
<?php // Posts To Show $max = 5; // Table Prefix $prefix = "mybb_"; // Get Posts $query = $db->query("SELECT * FROM ".$prefix."posts ORDER BY dateline DESC LIMIT 0,$max"); while($posts = $db->fetch_array($query)) { //PostInfo $tid = $posts['tid']; $pid = $posts['pid']; $subject = $posts['subject']; $date = date("H:i / d-m", $posts['dateline']); //UserInfo $username = $posts['username']; $uid = $posts['uid']; require_once "inc/functions_user.php"; $link = build_profile_link_for($username, $uid); //Posts $post .= "<a class=\"nav\" href=\"forum/showthread.php?tid={$tid}&pid={$pid}#pid={$pid}\">{$subject}</a> By ".$link." On ".$date."<br><br />"; } echo $post; ?>
So again, just a little updated version of it.
Thanks if anyone can help me with this. =]
PS/Edit: I'll give a cookie!