Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8973897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:33:11+00:00 2026-06-15T18:33:11+00:00

I got a point system where i want people to get 1 more point

  • 0

I got a point system where i want people to get 1 more point after a input/form. until now i use this code:

<?php
session_start();
//=============Configuring Server and Database=======
$host        =    'localhost';
$user        =    'root';
$password    =    '';
//=============Data Base Information=================
$database    =    'login';

$conn        =    mysql_connect($host,$user,$password) or die('Server Information is not Correct'); //Establish Connection with Server
mysql_select_db($database,$conn) or die('Database Information is not correct');

//===============End Server Configuration============

//=============Starting Registration Script==========


$username    =    mysql_real_escape_string($_POST['txtusername']);

//=============To Encrypt Password===================

//============New Variable of Password is Now with an Encrypted Value========

if(isset($_POST['btnRegister'])) //===When I will Set the Button to 1 or Press Button to register
{
$query = mysql_query("SELECT * FROM quiz WHERE username='$username'");
if(mysql_num_rows($query) > 5 ){
echo "Sorry but you can only take a quize once:S";

}else{

$insert = "UPDATE `users` SET `points` = '".$points."' +1 WHERE `username` = '".$username."'";

 mysql_query($insert); 



mysql_query ("insert into quiz(username)values('$username')");
header('location: succes.php');
}
}
?>

but this code doesnt seem to update/add 1 but insted it replace the number there with 1. so if i have 5 and i run this code it replace with 1 so then it says 1. How can i fix so it add/update? so if one have 3 points and run the code he get 4 points insted off getting repacec:

$insert = "UPDATE `users` SET `points` = '".$points."' +1 WHERE `username` = '".$username."'";
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:33:12+00:00Added an answer on June 15, 2026 at 6:33 pm

    you don’t need to use a variable $points. use the following UPDATE query,

    $insert = "UPDATE `users` SET `points` = (`points` + 1) WHERE `username` = '".$username."'";
    

    be warned that the query above is vulnerable with SQL Injection, please read the article below to protect from it,

    • How can I prevent SQL injection in PHP?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please tell me if I got this wrong. Anchor point is like a movable
Ok, let's get straight to the point. I got 2 questions 1. Why self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
This question is a bit rhetorical. At some point i got a feeling that
Before I start, I want to point out that I'm pretty sure this actually
I got into this learning the Android Operating System. I'm still in learning mode.
I got this application from the internet and I want to add some modifications.
It is quite possible that I may not have got the point, but I
I'm at my wit's end. The Share Point guy got a brain tumor and
At some point Find All References feature got broken for a single solution that
Case in point : I've got a handle to a window (for instance, using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.