Welcome, Guest. Please Login or Register.
November 28, 2024, 05:31:42 PM
Home Help Search Log in Register
News: If you are still using YaBB SE, please consider upgrading to SMF as soon as possible.

YaBB SE Community  |  English User Help  |  English Help  |  Negative Karma Display « previous next »
Pages: [1] 2 Reply Ignore Print
Author Topic: Negative Karma Display  (Read 1331 times)
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Negative Karma Display
« on: February 24, 2003, 10:05:08 PM »
Reply with quote

I posted about this a while back and didn't get any action, maybe because I wasn't really clear.  The karma maxes out at +/- 127 because of how the column was defined...tinyint I think.  So I went into the database and changed members.karmabad to smallint.  Well, the negative karma score all of a sudden wouldn't show up on the page anymore.  I went and changed it back to tinyint, and it still wouldn't display.



I guess in one of the upgrades, the karmabad and karmagood columns aren't defined as tinyint anymore...or maybe somewhere in all of my trying to fix it I changed them both back to smallint and can't remember.

Regardless...the negative karma won't display anymore.  I even did a clean install of 1.5.0 a couple of months ago for another reason and it still won't display.  The data is indeed in the database and will display on a page I did...but not beside the posts.

http://www.woopig.net/karma.php

Anyone have any suggestions...help...anything?  It's not critical or anything, but I sure would like to fix it.
Logged

[/url]
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Negative Karma Display
« Reply #1 on: February 25, 2003, 12:48:44 AM »
Reply with quote

Check Load.php and make sure it's building it right....

-[Unknown]
Logged
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Re:Negative Karma Display
« Reply #2 on: February 25, 2003, 02:06:45 AM »
Reply with quote

Quote from: [Unknown] on February 25, 2003, 12:48:44 AM
Check Load.php and make sure it's building it right....

-[Unknown]

That would infer that I know how to check that...which I don't.  That Karma page I put up...I did it with Dreamweaver MX...I can use a GUI...but not write much code.

;D
Logged

[/url]
Spaceman-Spiff
Mod Team
YaBB God
*****
Posts: 3689


My $txt[228]

Re:Negative Karma Display
« Reply #3 on: February 25, 2003, 06:36:47 AM »
Reply with quote

hmm... try to upgrade to 1.5.1
i think it fixes the karma limit too...
Logged

   My mods, ysePak, codes, tutorials
    Support question IMs = bad.
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Re:Negative Karma Display
« Reply #4 on: February 25, 2003, 04:31:20 PM »
Reply with quote

Quote from: Spaceman-Spiff on February 25, 2003, 06:36:47 AM
hmm... try to upgrade to 1.5.1
i think it fixes the karma limit too...

Got it...but I'll wait until you guys release it from test mode.  I got completely burned by upgrading a few weeks ago...had to reinstall clean and import the data from the previous database to the new, which was no fun.
Logged

[/url]
D Mon
Jr. Member
**
Posts: 86


I'm a llama!

Re:Negative Karma Display
« Reply #5 on: February 26, 2003, 12:11:29 AM »
Reply with quote

Hey can ya help me get this feature on my board, dude?
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Negative Karma Display
« Reply #6 on: February 26, 2003, 12:27:18 AM »
Reply with quote

Quote from: D Mon on February 26, 2003, 12:11:29 AM
Hey can ya help me get this feature on my board, dude?

It's already there.  Just turn it on in 'Mods' Settings.

-[Unknown]
Logged
D Mon
Jr. Member
**
Posts: 86


I'm a llama!

Re:Negative Karma Display
« Reply #7 on: February 26, 2003, 12:37:15 AM »
Reply with quote

Not the Karma itself but the Karma Total page-
Or else Spiff wouldve never sent me here instead he woulda told me in my request post.
Logged
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Re:Negative Karma Display
« Reply #8 on: February 26, 2003, 02:21:31 AM »
Reply with quote

I don't know how to make it a mod, but I'll sure be glad to email the page to anyone who wants it.  If your mySQL database is still the default YaBB name you can probably just drop the page on your server and change the connection string if needed...and it should work.
Logged

[/url]
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Re:Negative Karma Display
« Reply #9 on: February 26, 2003, 02:25:33 AM »
Reply with quote

Or I guess I could just post it...  ;D (hey...php purists don't yell at me...like I said previously, I made this page using Dreamweaver MX and there may be extraneous stuff in the code that people that write it by hand will scoff at...

Quote
<?php require_once('Connections/woopig.php'); ?>
<?php
mysql_select_db($database_woopig, $woopig);
$query_rsKarmaTotal = "SELECT sum(karmagood)-sum(karmabad) FROM yabbse_members";
$rsKarmaTotal = mysql_query($query_rsKarmaTotal, $woopig) or die(mysql_error());
$row_rsKarmaTotal = mysql_fetch_assoc($rsKarmaTotal);
$totalRows_rsKarmaTotal = mysql_num_rows($rsKarmaTotal);

$maxRows_rsRankBadKarma = 20;
$pageNum_rsRankBadKarma = 0;
if (isset($HTTP_GET_VARS['pageNum_rsRankBadKarma'])) {
 $pageNum_rsRankBadKarma = $HTTP_GET_VARS['pageNum_rsRankBadKarma'];
}
$startRow_rsRankBadKarma = $pageNum_rsRankBadKarma * $maxRows_rsRankBadKarma;

mysql_select_db($database_woopig, $woopig);
$query_rsRankBadKarma = "SELECT membername, (karmabad) FROM yabbse_members ORDER BY (karmabad) desc";
$query_limit_rsRankBadKarma = sprintf("%s LIMIT %d, %d", $query_rsRankBadKarma, $startRow_rsRankBadKarma, $maxRows_rsRankBadKarma);
$rsRankBadKarma = mysql_query($query_limit_rsRankBadKarma, $woopig) or die(mysql_error());
$row_rsRankBadKarma = mysql_fetch_assoc($rsRankBadKarma);

if (isset($HTTP_GET_VARS['totalRows_rsRankBadKarma'])) {
 $totalRows_rsRankBadKarma = $HTTP_GET_VARS['totalRows_rsRankBadKarma'];
} else {
 $all_rsRankBadKarma = mysql_query($query_rsRankBadKarma);
 $totalRows_rsRankBadKarma = mysql_num_rows($all_rsRankBadKarma);
}
$totalPages_rsRankBadKarma = ceil($totalRows_rsRankBadKarma/$maxRows_rsRankBadKarma)-1;

$maxRows_rsRankKarmaGood = 20;
$pageNum_rsRankKarmaGood = 0;
if (isset($HTTP_GET_VARS['pageNum_rsRankKarmaGood'])) {
 $pageNum_rsRankKarmaGood = $HTTP_GET_VARS['pageNum_rsRankKarmaGood'];
}
$startRow_rsRankKarmaGood = $pageNum_rsRankKarmaGood * $maxRows_rsRankKarmaGood;

mysql_select_db($database_woopig, $woopig);
$query_rsRankKarmaGood = "SELECT membername, karmagood FROM yabbse_members ORDER BY karmagood desc";
$query_limit_rsRankKarmaGood = sprintf("%s LIMIT %d, %d", $query_rsRankKarmaGood, $startRow_rsRankKarmaGood, $maxRows_rsRankKarmaGood);
$rsRankKarmaGood = mysql_query($query_limit_rsRankKarmaGood, $woopig) or die(mysql_error());
$row_rsRankKarmaGood = mysql_fetch_assoc($rsRankKarmaGood);

if (isset($HTTP_GET_VARS['totalRows_rsRankKarmaGood'])) {
 $totalRows_rsRankKarmaGood = $HTTP_GET_VARS['totalRows_rsRankKarmaGood'];
} else {
 $all_rsRankKarmaGood = mysql_query($query_rsRankKarmaGood);
 $totalRows_rsRankKarmaGood = mysql_num_rows($all_rsRankKarmaGood);
}
$totalPages_rsRankKarmaGood = ceil($totalRows_rsRankKarmaGood/$maxRows_rsRankKarmaGood)-1;

mysql_select_db($database_woopig, $woopig);
$query_rsKarmaAbs = "SELECT yabbse_members.memberName, (karmagood)-(karmabad) as total FROM yabbse_members where (karmagood)-(karmabad) <> 0 ORDER BY (karmagood)-(karmabad) desc";
$rsKarmaAbs = mysql_query($query_rsKarmaAbs, $woopig) or die(mysql_error());
$row_rsKarmaAbs = mysql_fetch_assoc($rsKarmaAbs);
$totalRows_rsKarmaAbs = mysql_num_rows($rsKarmaAbs);
?>
<html>
<head>
<title>Woopig Karma Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>

<body>
<p class="headline">Quick and Dirty Karma Page</p>
<p class="text">Total Board Karma Score = <strong><?php echo $row_rsKarmaTotal['sum(karmagood)-sum(karmabad)']; ?></strong></p>
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CC0000">
 <tr class="text">
   <td><strong><font color="#FFFFFF">Good Karma Score Leaders</font></strong></td>
   <td><strong><font color="#FFFFFF">Bad Karma Score Leaders</font></strong></td>
 </tr>
 <tr>
   <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
       <?php do { ?>
       <tr bgcolor="#FFFFFF" class="text">
         <td><?php echo $row_rsRankKarmaGood['membername']; ?> </td>
         <td><?php echo $row_rsRankKarmaGood['karmagood']; ?></td>
       </tr>
       <?php } while ($row_rsRankKarmaGood = mysql_fetch_assoc($rsRankKarmaGood)); ?>
     </table></td>
   <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
       <?php do { ?>
       <tr bgcolor="#FFFFFF" class="text">
         <td><?php echo $row_rsRankBadKarma['membername']; ?></td>
         <td><?php echo $row_rsRankBadKarma['karmabad']; ?></td>
       </tr>
       <?php } while ($row_rsRankBadKarma = mysql_fetch_assoc($rsRankBadKarma)); ?>
     </table></td>
 </tr>
</table>
<p>&nbsp;</p>
<table width="300" border="0" cellpadding="0" cellspacing="0" bgcolor="#CC0000">
 <tr>
   <td colspan="2" class="text"><strong><font color="#FFFFFF">Overall Karma Score
     (Good-Bad) where outcome is not 0</font></strong></td>
 </tr>
 <?php do { ?>
 <tr bgcolor="#FFFFFF" class="text">
   <td><?php echo $row_rsKarmaAbs['memberName']; ?></td>
   <td><?php echo $row_rsKarmaAbs['total']; ?></td>
 </tr>
 <?php } while ($row_rsKarmaAbs = mysql_fetch_assoc($rsKarmaAbs)); ?>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($rsKarmaTotal);

mysql_free_result($rsRankBadKarma);

mysql_free_result($rsRankKarmaGood);

mysql_free_result($rsKarmaAbs);
?>

And the connection string...
Quote
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_woopig = "localhost";
$database_woopig = "yabbse";
$username_woopig = "********";
$password_woopig = "********";
$woopig = mysql_pconnect($hostname_woopig, $username_woopig, $password_woopig) or die(mysql_error());
?>
Logged

[/url]
D Mon
Jr. Member
**
Posts: 86


I'm a llama!

Re:Negative Karma Display
« Reply #10 on: February 26, 2003, 03:29:33 AM »
Reply with quote

Oh brother I'm lost-

What should I name this file? Or is it 2 files?
maybe named karma.php and karma1.php and link karma.php?
Logged
SteveJ
Jr. Member
**
Posts: 52


I'm No Llama...

stjaxn@hotmail.com WWW
Re:Negative Karma Display
« Reply #11 on: February 26, 2003, 03:53:04 AM »
Reply with quote

Quote from: D Mon on February 26, 2003, 03:29:33 AM
Oh brother I'm lost-

What should I name this file? Or is it 2 files?
maybe named karma.php and karma1.php and link karma.php?

Yeah...and I'm not going to be a whole lot of help due to lack of knowledge.  But here goes...

That big bit of code up there...save it as karma.php.

Create a folder in the directory that you put karma.php in named connections.  Create a file named whateveryouwant.php and put it in that folder.  Then replace woopig.php in karma.php with whateveryouwant.php.

There's probably a lot more to change in karma.php...but I don't know enough (and not trying to learn) about it.
Logged

[/url]
D Mon
Jr. Member
**
Posts: 86


I'm a llama!

Re:Negative Karma Display
« Reply #12 on: February 26, 2003, 10:41:49 AM »
Reply with quote

If it works I ain't complaing!

Hey the only thing-Is  taht your entire good and bad list?
I would like to have everyone show.
Logged
D Mon
Jr. Member
**
Posts: 86


I'm a llama!

Re:Negative Karma Display
« Reply #13 on: February 26, 2003, 11:09:29 AM »
Reply with quote

Wait I may have-
However I'm lost on my server info
could you just replace your info with the titles of what I need to exchange all the _woopig with?

-I'm correct in saying every woopig you have in both files shouldn't be changed to the same thing- right?
« Last Edit: February 26, 2003, 11:24:49 AM by D Mon » Logged
Zayexi Hayati
Noobie
*
Posts: 25


Making this forum better one post at a time.

WWW
Re:Negative Karma Display
« Reply #14 on: February 26, 2003, 06:03:45 PM »
Reply with quote

Okay I have tried this and it works.
D Mon this is what I did see if it helps you.

I edited the woopig.php like this.

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_woopig "localhost";
$database_woopig "Your_database_name";
$username_woopig "your_mySQL_username";
$password_woopig "your_mySQL_password";
$woopig mysql_pconnect($hostname_woopig$username_woopig$password_woopig) or die(mysql_error());
?>


then in karma.php replace this.

<?php require_once('Connections/woopig.php'); ?> to this <?php require_once('relative/path/to/woopig.php'); ?>

Then change each instance of
yabbse_members to your_database_prefix_members
Hope this helps you.
« Last Edit: February 26, 2003, 06:04:58 PM by zayexi » Logged

The important thing is not to stop questioning.
Pages: [1] 2 Reply Ignore Print 
YaBB SE Community  |  English User Help  |  English Help  |  Negative Karma Display « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.054 seconds with 20 queries.