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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:26:40+00:00 2026-06-05T01:26:40+00:00

I currently have a problem with the code I have below.. It keeps saying

  • 0

I currently have a problem with the code I have below..

It keeps saying

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: 
Integrity constraint violation: 1048 Column 'Firstname' cannot be null' 
in C:\xampp\htdocs\clubresults\checkregister.php:30 Stack trace: #0 
C:\xampp\htdocs\clubresults\checkregister.php(30): PDOStatement->execute() 
#1 {main} thrown in C:\xampp\htdocs\clubresults\checkregister.php on line 30

I’ve tried everything I know but I just cannot remove that error… any kind of help is really appreciated 😀
This php file is called checkregister.php

  $pdo = new PDO('mysql:host=localhost;dbname=clubresults', 'root', '12345678');
  #Set Error Mode to ERRMODE_EXCEPTION.
  $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  

  $stmt = $pdo->prepare('INSERT INTO members 
           (firstname, surname, DD, MM, YYYY, 
           email, Player1, Player2, Player3, Player4, Player5)
          VALUES 
           (:firstname, :surname, :DD, :MM, :YYYY, 
           :email, :Player1, :Player2, :Player3, :Player4, :Player5)');

  $stmt->bindParam(':firstname', $_GET['firstname']);
  $stmt->bindParam(':surname', $_GET['surname']);
  $stmt->bindParam(':DD', $_GET['DD']);
  $stmt->bindParam(':MM', $_GET['MM']);
  $stmt->bindParam(':YYYY', $_GET['YYYY']);
  $stmt->bindParam(':email', $_GET['email']);
  $stmt->bindParam(':Player1', $_GET['Player1']);
  $stmt->bindParam(':Player2', $_GET['Player2']);
  $stmt->bindParam(':Player3', $_GET['Player3']);
  $stmt->bindParam(':Player4', $_GET['Player4']);
  $stmt->bindParam(':Player5', $_GET['Player5']);
  $stmt->execute();

This is my form in another php file:

<form name="register" method="post" action="checkregister.php">

<!--Text, using <p> tag for new line-->
Main Account Registration <p>
* All Fields Mandatory <P>


<div class="required_field">
<label for="leadername">Team Leader's First Name</label>
<input name="firstname" type="text" value="hihi"><p>
<span id="firstnameerror" class="error"></span>
</div>

the same code repeats for each of the other ones such as Surname, DD MM YY, etc

<input type="submit" name="submitbutton" id="submitbutton" value="Register">
<input type="reset" name="resetbutton" id="resetbutton" value="Clear all Fields">
</form>
  • 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-05T01:26:42+00:00Added an answer on June 5, 2026 at 1:26 am

    Working backwards:

    • MySQL complains about a null value; so why is null received?
    • PDO passes null to MySQL if a null value is passed in bindParam(); why are we passing a null value?
    • When a variable in PHP is not defined and you attempt to use it, it will a) issue a warning and b) implicitly set it to null; why are we using an undefined variable?
    • The $_GET['firstname'] is not defined (amongst others); why is is not defined?
    • You’re using method="post" in your form, so the form entries are passed via $_POST instead of $_GET.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently working on Problem 62 I have tried the following code to
I have a problem with obtaining the current user location. Code at first works
The following code summarizes the problem I have at the moment. My current execution
ok i got this problem. i have this routes: (code bit change) File:/home/dotcloud/current/config/routes.js exports.routes
I currently have a problem with my jgroups configuration, causing thousands of messages getting
I currently have a problem attepting to update a record within my database. I
I currently have a problem within PHP where I want to sort these posts
I am new to Rails routing and I currently have a problem and hope
I have a problem that output string must be utf8-formatted, I am writing currently
i am currently working on a facebook game and i have a problem concerning

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.