pgowder
04-04-2002, 02:04 PM
Ok, I've made a small script that shows the ten highest karma points.
<?
$hostname = "localhost";
$username = "username";
$password = "password";
$dbName = "gathering";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to database");
@mysql_select_db("$dbName") or die("Unable to select database");
$query = "select uid, newthread+reply+view+admin_mod+morereply+totalpena lty as total from storepoint order by total desc limit 0,10";
$my_q = mysql_query($query) or die(mysql_error());
$row_count = mysql_num_rows($my_q);
for ($i=0; $i<$row_count; $i++) {
list($uid, $total) = mysql_fetch_row($my_q);
$my_q2 = mysql_query("select username from user where userid='$uid'") or die(mysql_error());
list($username) = mysql_fetch_row($my_q2);
print "$username has $total points<br>";
mysql_free_result($my_q2);
}
mysql_free_result($my_q);
?>
My first question, is this gives me a different result than what the Karma hack displays. If I look at the storepoint table, and add it by hand, my script gives the correct answer???
Second question, how can I have this script also add the user's thread views?
Thread views are stored in user in column views.
Thanks
<?
$hostname = "localhost";
$username = "username";
$password = "password";
$dbName = "gathering";
MYSQL_CONNECT($hostname,$username,$password) OR DIE("Unable to connect to database");
@mysql_select_db("$dbName") or die("Unable to select database");
$query = "select uid, newthread+reply+view+admin_mod+morereply+totalpena lty as total from storepoint order by total desc limit 0,10";
$my_q = mysql_query($query) or die(mysql_error());
$row_count = mysql_num_rows($my_q);
for ($i=0; $i<$row_count; $i++) {
list($uid, $total) = mysql_fetch_row($my_q);
$my_q2 = mysql_query("select username from user where userid='$uid'") or die(mysql_error());
list($username) = mysql_fetch_row($my_q2);
print "$username has $total points<br>";
mysql_free_result($my_q2);
}
mysql_free_result($my_q);
?>
My first question, is this gives me a different result than what the Karma hack displays. If I look at the storepoint table, and add it by hand, my script gives the correct answer???
Second question, how can I have this script also add the user's thread views?
Thread views are stored in user in column views.
Thanks