Welcome, Guest.
Login
|
Register
Username:
Password:
Remember me:
Points
Please log in to post.
Watch thread
Unwatch thread
Started by
Creation
24 Sep 2011 21:15
By
Creation
(
46
)
On 24 Sep 2011 21:17
I need to add a certain number of points when someone posts a status, and in my post.php, I have
mysql_query("UPDATE user SET points = '+2'
WHERE username = '$_SESSION[username]'");
It just sets the points to 2. I need help with adding 2 to the points. Thanks.
Che la stimo, che la stimo!
By
Skittles
(
1292
)
On 25 Sep 2011 00:13
That's because you're setting the points equal to positive two. To add two onto the current value, try this:
<?php
$sql=mysql_fetch_array(mysql_query("SELECT * FROM user WHERE username='$_SESSION[username]'"));
$pts=$sql[points];
mysql_query("UPDATE user SET points='$pts+2'");
?>
That will get the job done.
It's my job to help the next generation, and set a good example for them. And for that I'll gladly lay down my life.
By
Creation
(
46
)
On 25 Sep 2011 00:26
That doesn't do anything. :/
Che la stimo, che la stimo!
By
Doctor Who
(
5
)
On 25 Sep 2011 09:46
Type "or die(mysql_error());" after the query, or else errors will go unnoticed.
Trust me, I am The Doctor.
By
Creation
(
46
)
On 25 Sep 2011 11:33
There were errors, and I fixed them, but now the code does nothing.
Che la stimo, che la stimo!
By
M.J kInG
(
1334
)
On 26 Sep 2011 13:53
Go to google type in Mysql updated
it show you how to make points.
A true developer
Nintendo 3DS is ™ Nintendo Co. Ltd. This website is ©2009-2024 HullBreach Studios. All rights reserved. Members are responsible for their own content. No account information will be given to third-parties without your consent.