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 8948147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:55:07+00:00 2026-06-15T12:55:07+00:00

Okay I have a basic task that I want to complete and I could

  • 0

Okay I have a basic task that I want to complete and I could do it if this site wasnt going be live but since it is I am going want it to be secure and my current method needs to be better

What I want is to change how many credits a user has so another words I have it where once they click the submit button it runs a php script and just simple pull that data under there account for Credits take that number (int) and subtract 1

But I am using this

$query = mysql_query("SELECT * FROM UsersList WHERE Credits='$CurrentCredits'");

and then I would simply

  $db = new PDO('mysql:dbname=;host=', aooza, 'Password');

     $insert = 'INSERT INTO `LIST` (`Credits`) VALUES (:NewCreditCount)';

    $statement = $db->prepare($insert);
    $statement->bindParam(':Credit', $_SESSION['Credit'], PDO::PARAM_STR);
    $statement->execute();

But of course this wont work because my main issue is that it is just enters the new credit count on a new row so there is no user and well I dont know a better way to say that

How do I make it where It changes it for that row rather then just abroad

Update code

$Credits = $_SESSION['Credits'];

 $update= 'UPDATE `PingPalooza` SET `Credits` = `Credits` - 1 WHERE `Email` = :Email LIMIT 1';

 $_SESSION['Credits']=$Credits;

 $statement = $db->prepare($update);
 $statement->bindParam(':Credits', $_SESSION['Credits'], PDO::PARAM_STR);
 $statement->bindParam(':Email', $_SESSION['Email']);
 $statement->execute();

Obviously this isn’t exactly what you gave me but I added the two variable things just to try and get it to work myself lol
lol always keep trying

  • 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-15T12:55:08+00:00Added an answer on June 15, 2026 at 12:55 pm

    Use an UPDATE query to modify an existing row:

    $update= 'UPDATE `LIST` SET `Credits` = `Credits` - 1 WHERE `UserId` = :UserId LIMIT 1';
    
    $statement = $db->prepare($update);
    
    // you don'e need this line below if you are doing the subtraction in the query (like above)
    //$statement->bindParam(':Credit', $_SESSION['Credit'], PDO::PARAM_STR);
    $statement->bindParam(':UserId', $_SESSION['UserId']);
    $statement->execute();
    

    Assuming your target UserId is in $_SESSION['UserId'] and your field in the table is UserId.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay. This is propably very basic and noobie, but I have about 20+ stores
Okay, this is probably very simple but, I have the below checks (not at
Okay, so I want to make a polling site but it doesn't work like
Okay then we have a basic situation, that is drawing a circle and filling
Okay lets say I have a basic demographic content type (Client) that I am
okay so this seemed like it should be pretty basic but I just can't
okay i have been trying to understand this for hours i am learning VB
Okay I have a large CRUD app that uses tabs with Forms embedded in
Okay I have updated my code a little, but I am still not exactly
Okay so i have this code: if (isset($_GET['book'])) { $query= SELECT book_id, title, authors.`author`

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.