I am trying to convert an mccodes mode over to grgp (simple rating system).
I have made 2 columns inside grpgusers called rate and canrate
Created one file called giverate.php as below. I know the show rating is wrong also... had not got that far as its already falling over.
Don't hate on me please as my level of experience is looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooow.
<?php
mysql_query("UPDATE grpgusers SET rate=rate+1 WHERE user_class->id={$_GET['u']}", $c);
mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE userid={$user_class->userid}", $c);
$b = mysql_query("SELECT username,rate FROM grpgusers WHERE user_class->id={$_GET['u']}", $c);
$a = mysql_fetch_array($b);
print "You have given 1 rating to {$user_class->username}!
Their rating is now {$a['rate']}!";
die($h->endpage());
}else if ($_GET['action'] == "take")
{
mysql_query("UPDATE grpgusers SET rate=rate-1 WHERE user_class->id={$_GET['u']}", $c);
mysql_query("UPDATE grpgusers SET canrate=canrate-1 WHERE userid={$user_class->userid}", $c);
$b = mysql_query("SELECT username,rate FROM grpgusers WHERE user_class->id={$_GET['u']}", $c);
$a = mysql_fetch_array($b);
print "You have taken 1 rating from {$user_class->username}!
Their rating is now {$a['rate']}!";
die($h->endpage());
}else{
print "Unknown action!";
die($h->endpage());
}
$h->endpage();
?>
Here is the profile code.
<?php
if ($user_class->rate == 0)
{
$rate = "<font color='blue'>{$user_class->id['rate']}</font>";
}else if ($r['rate'] > 0)
{
$rate = "<font color='green'>{$user_class->id['rate']}</font>";
}else if ($r['rate'] < 0)
{
$rate = "<font color='red'>{$user_class->id['rate']}</font>";
}
print "Rating: [<a href='giverate.php?u={$user_class->id}&action=take'>-</a>] {$rate} [<a href='giverate.php?u={$user_class->id}&action=give'>+</a>]";
?>
</td></tr>
<?
if ($user_class->id != $profile_class->id){
?>
If someone could point me in the correct direction that would be great thanks.
Grumpy.