Geek points system?

Associate
Joined
23 Mar 2009
Posts
348
Location
Midlands
At work the IT dept & I have a 'geek points' chart whereby we get +x amount of points for any geeky stuff we do.

I wanted to create a little site on the network so we could log how many points each person has.

So what it would be is:
Main page with an overview of points
User profile page with points/reason breakdown
Form to add points to certain user

Would this be fairly easy to do? I can make one myself for just adding points, but get a bit lost when it comes to the reason bit!
Or are there any similar scripts out there already that you know of?


Ta :)
 
Get LAMP/WAMP installed then it becomes a straight forward DB app which could be done with a single 'points/reason' table (fields could include - auto inc ID, user id, rewarded points, reason, date/time), although I’d recommend a dedicated 'user' (fields being - auto inc ID, User name etc) table and link the 'user id' between the two.

The basic functionality is a form inserting to the 'points/reason' table with the user id, reward point(s) and reason. Grouping (use GROUP BY function) the user id's (do a join with the user table for names) and summing the points field (use SUM() function) will return the totals for everyone. To display individual reasons for a particular user would be a simple where query ie: where user_id = 2 etc

And obviously you can make it as simple or complicated (delete points/reasons, user accounts with permissions etc etc) as you want. And if you use a JQuery UI framework, Vaadin etc, you could knock up something that looked ok reasonably quickly.
 
Get LAMP/WAMP installed then it becomes a straight forward DB app which could be done with a single 'points/reason' table (fields could include - auto inc ID, user id, rewarded points, reason, date/time), although I’d recommend a dedicated 'user' (fields being - auto inc ID, User name etc) table and link the 'user id' between the two.

The basic functionality is a form inserting to the 'points/reason' table with the user id, reward point(s) and reason. Grouping (use GROUP BY function) the user id's (do a join with the user table for names) and summing the points field (use SUM() function) will return the totals for everyone. To display individual reasons for a particular user would be a simple where query ie: where user_id = 2 etc

And obviously you can make it as simple or complicated (delete points/reasons, user accounts with permissions etc etc) as you want. And if you use a JQuery UI framework, Vaadin etc, you could knock up something that looked ok reasonably quickly.

Hmm sounds logical! :) Will have to do a bit of reading up as only have limited knowledge but thanks so much for the help :) +100 awesome points for you!
 
Okay, I've got quite far, but struggling with one bit...

I have two tables in MySQL with the following:

points: pointsid (primary key), userid, points, reason
user: userid, username

And I'm trying to get it to display in a table with the below headings:

Username, points (sum)

Now I've done it fine with a table with userid, username (both from 'points') but have no idea how to pull data from two sql tables into one html table....?


Code:
PHP:
<html>
<head>
<title>Geek Points - League Table</title>
</head>
<body>
<?php
include('db.php'); //grabs database details & connects
$con = mysql_connect($dbserver,$dbuser,$dbpass);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("geekpoints", $con);
$query = "SELECT userid, SUM(Points) FROM points"; 
$result = mysql_query($query) or die(mysql_error());

// Print out result
echo("<table align='center' border='1' cellspacing='0'><tr align='center'><td>Name</td><td>Points</td></tr>");
while($row = mysql_fetch_array($result)){
	echo "<tr align='center'><td><a href='user.php?uid=". $row['userid']. "'>" .$row['userid']. "</a></td><td>". $row['SUM(Points)']. "</td>";
	echo "</tr>";
}
echo("</table>");
?></font></body>
</html>
 
Nevermind, figured it out :D

PHP:
<html>
<head>
<title>Geek Points - League Table</title>
</head>
<body><font face="Myriad Pro,Tahoma,Arial"><?php
include('db.php'); //grabs database details & connects
$con = mysql_connect($dbserver,$dbuser,$dbpass);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("geekpoints", $con);
$query = "SELECT points.userid, username, SUM(Points) FROM points, users WHERE points.userid = users.userid GROUP BY username"; 
$result = mysql_query($query) or die(mysql_error());

// Print out result
echo("<table align='center' border='1' cellspacing='0'><tr align='center'><td>Name</td><td>Points</td></tr>");
while($row = mysql_fetch_array($result)){
	echo "<tr align='center'><td><a href='user.php?uid=". $row['userid']. "'>" .$row['username']. "</a></td><td>". $row['SUM(Points)']. "</td>";
	echo "</tr>";
}
echo("</table>");
?></font></body>
</html>
 
Back
Top Bottom