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

  • Home
  • SEARCH
  • 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 8270663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:38:55+00:00 2026-06-08T06:38:55+00:00

I keep getting this error: You have an error in your SQL syntax; check

  • 0

I keep getting this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE username = ‘username’ VALUES (‘value’)’ at line 1.
The code is supposed to take the value that the logged in user enters into the form, and then insert that value into the money column of the table.

 <?php include("auth.php");?>

 <?php

 if(isset($_POST['submit']))
 {


 $getmoney = @mysql_query("INSERT INTO players (money) WHERE username = 
'".$_SESSION['username']."' VALUES ('$_POST[amount]')")
 or die("Error: ".mysql_error());

echo '
<div style="
  top: 395;
  left: 99;
  position: absolute;
  z-index: 1;
  visibility: show;">
 Money Received.
 </div>
 ';
  }
  ?>

  </head>
  <body>
  <p>Bank</p>
  Enter amount of money to recieve.<br>
  <form action="bank.php" method="post">
  <table border=2>
  <tr>
  <td>Amount to Receive:</td><td><input type="text" name="amount" size="20px"></input>    
  </td>
  </tr>
  </table>
  <input type="submit" name="submit" value="Get Money"></input>
  </form><br><br>
<hr size=2>
<?php include("footer.php");?>
  </body>
  </html>
  • 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-08T06:38:58+00:00Added an answer on June 8, 2026 at 6:38 am

    The query syntax is wrong.

    @mysql_query("INSERT INTO players (money) VALUES (".$_POST[amount].") WHERE username = '".$_SESSION['username']."'";)
    

    Syntax

    INSERT INTO table_name(field1, field2...) VALUES (value1, value2,...) WHERE CONDITION
    

    EDIT: As you want to update the value, (Update Query)

    @mysql_query("UPDATE players SET money = money+".$_POST[amount]." WHERE username = '".$_SESSION['username']."'";)
    

    Also, your query is susceptible to SQL Injection, so you might want to use PDO/MySQLi or al the very least, call mysql_real_escape_string() on all values being passed by the user.
    Read this.

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

Sidebar

Related Questions

You have an error in your SQL syntax; check the manual that corresponds to
I keep getting the following error: You have an error in your SQL syntax;
I keep getting this error: MySQL said: #1064 - You have an error in
I keep getting this error but this sql statement works fine in mysql it
I keep getting this error and have no idea why. I googled and scanned
I keep getting this error and I have tried putting quotes around the actual
I keep getting this error all over the place where I only have jquery
I keep getting this error and I really dont know why. I have tried
i have this php code and keep on getting errors upon fixing each error.
I keep getting this error for the below MySQL SP any ideas? CREATE PROCEDURE

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.