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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:01:54+00:00 2026-06-09T14:01:54+00:00

I need a mechanism that inserts the data from a newly registered user to

  • 0

I need a mechanism that inserts the data from a newly registered user to a database. I use PDO to do this, and this is my current code:

$dbc = new PDO('mysql:host=localhost;dbname=*****', *****, *****);

$insert_query = $dbc->prepare('INSERT INTO members(name, gender, email, pass)   
VALUES(:name, :gender, :email, :pass) WHERE email = :email LIMIT 1');

$insert_query->execute(array(':name' => $name, ':gender' =>    
$gender, ':email' => $email,  ':pass' => $pass));

However, nothing happens when a user submits the register form. I tried to echo $gender, $name, $email and $pass, and they all showed correct values. I am new to PDO, and I’m not sure what the problem could be at all. Is it a syntax error of some sort, or is it something else?

I don’t receive any error messages.

  • 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-09T14:01:56+00:00Added an answer on June 9, 2026 at 2:01 pm

    I don’t believe it is valid to include a LIMIT clause in an INSERT statement. LIMIT is not among the optional clauses in the MySQL INSERT syntax reference.

    You also have a WHERE clause, which is also invalid in an INSERT statement.

    I suspect you don’t have error reporting turned on, since this ought to have been a fatal error or thrown an exception if the statement failed to prepare() due to syntax errors. You would have gotten an error similar to

    ERROR 1064 (42000): 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 ‘LIMIT 1’

    $insert_query = $dbc->prepare('INSERT INTO members(name, gender, email, pass)   
    VALUES(:name, :gender, :email, :pass) WHERE email = :email LIMIT 1');
    //------------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^
    

    By definition, an INSERT statement inserts exactly as many rows as you have () groups* for in your VALUES (), so there’s no need for a LIMIT anyway. You could use a LIMIT in an INSERT INTO...SELECT... statement, but in that case, the LIMIT is a clause of the SELECT component rather than the INSERT.

    * Ignoring potential key violations or other insert problems, obviously

    The fact that you have conflated multiple components (WHERE,LIMIT) from UPDATE statements makes me wonder if you actually intended this to be an UPDATE rather than an INSERT statement to begin with. INSERT is only for new rows. UPDATE is for changing existing rows, and both WHERE and LIMIT are valid in UPDATE.

    That would look like:

    $upd_query = $dbc->prepare('UPDATE members SET name = :name, gender = :gender, email = :email, pass = :pass) WHERE email = :email LIMIT 1');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

BeautifulSoup newbe... Need help Here is the code sample... from mechanize import Browser from
I need some suggestions for how to implement a very basic mechanism that logs
I am working on this code where, I need to get the instructions executed
I have a MYSQL table that holds events information. I need a mechanism that
I need to create a SQL Server database that will recieve updates by some
List Comprehension is a very useful code mechanism that is found in several languages,
I need to implement a heartbeat-mechanism that sends a 'touch'-message to an external service
For a real estate website I need to implement a search mechanism that allows
I need an efficient mechanism for detecting changes to the DOM. Preferably cross-browser, but
I need to design a translation mechanism/strategy for the static text in my (scalable)

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.