View Full Version : Point System


spitfire333190
01-04-2006, 09:56 PM
My friend and I are creating a virtual pet site. We have most of it finished but the point system. Note: I do not know that much php/mysql!

Would it be something like this or am I really far from it-
$c_points=mysql_query("SELECT * FROM table WHERE username='username") or die(mysql_error());
$c_points=mysql_fetch_array($c_points);
$c_points=$c_points['points'];
$n_points=$c_points *Would I use a random function here?
mysql_query("UPDATE table SET points='$n_points' WHERE username='username'") or die(mysql_error());

harmor
01-04-2006, 10:10 PM
$c_points = mysql_query("SELECT * FROM table WHERE username='$username") or die(mysql_error());
$c_points = mysql_fetch_array($c_points);
$c_points = $c_points['points'];
$n_points = $c_points + 10;
mysql_query("UPDATE table SET points='$n_points' WHERE username='$username'") or die(mysql_error());



Where is $username coming from?
WHERE username='$username

What this does is takes the points they currently have and adds ten to it.
$n_points = $c_points + 10;

spitfire333190
01-04-2006, 10:14 PM
I thought username would be the persons username account!

harmor
01-04-2006, 10:21 PM
Well you can't put $username and it'll automatically get the user's account.

Tell me the process of how you get $username