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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:50:44+00:00 2026-06-03T23:50:44+00:00

I am getting this error: Column ‘Username’ cannot be null. First of all I

  • 0

I am getting this error: Column ‘Username’ cannot be null.

First of all I am using jQuery UI. I made a modal form for registering users.
Here an extraction from my JS:

if ( bValid ) {
    var form = $('#register_form');  
    var data = form.serialize();  
    $.post('index.php?section=register', data, function(response) { 
            alert(response);
            $( "#dialog_create_user_ok" ).dialog( "open" );
    });  
    $( this ).dialog( "close" );
}

This seems to work well. Checked it with firebug and I get the correct post values. Username=…&Password=…

Now an extraction from my register.php which is defined by section=register (used a Tutorial):

if ('POST' == $_SERVER['REQUEST_METHOD']) {
    if (!isset($_POST['Username'], $_POST['Password'])) {
        return INVALID_FORM;
    }
    //Check for already existing User
    $sql = 'SELECT
                ID
            FROM
                User
            WHERE
                Username = ?
            LIMIT
                1';
    $stmt = $db->prepare($sql);
    if (!$stmt) {
        return $db->error;
    }
    $stmt->bind_param('s', $Username);
    $stmt->execute();
    $stmt->store_result();
        if ($stmt->num_rows) {
        return 'User already exists.';
    }
    $stmt->close();
    //Add User
    $sql = 'INSERT INTO
                User(Username)
            VALUES
                (?)';
    $stmt = $db->prepare($sql);
    if (!$stmt) {
        echo "hier bin ich";
        return $db->error;
    }
    $stmt->bind_param('s', $Username);
    if (!$stmt->execute()) {
        return $stmt->error;
    }
    $UserID = $stmt->insert_id;
    //Update password for User
    $sql = 'UPDATE
                User
            SET
                Password = ?
            WHERE
                ID = ?';
    $stmt = $db->prepare($sql);
    if (!$stmt) {
        return $db->error;
    }
    $Hash = md5(md5($UserID).$Password);
    $stmt->bind_param('si', $Hash, $UserID);
    if (!$stmt->execute()) {
        return $stmt->error;
    }
    return showInfo('Added user.');
}
return $ret;

It’s really strange. This code worked for me today. Then I had to change folders to get a better structure and now this.

Btw. this is my table User (ID = primary key):
!
http://imageshack.us/photo/my-images/823/unbenanntjfz.jpg/

  • 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-03T23:50:46+00:00Added an answer on June 3, 2026 at 11:50 pm

    It looks like your code is binding $Username to your MySQL statements, which from the code provided is not defined.

    Perhaps you meant to bind $_POST['Username']? Same thing with $Password later in the script.

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

Sidebar

Related Questions

Why am I getting this error: 1054 - Unknown column 't.type' in 'field list'
Getting this error: Each GROUP BY expression must contain at least one column that
i was getting this error com.ibm.db2.jcc.b.SqlException: Invalid argument: unknown column name COL1 when trying
I'm getting this error: Column count doesn't match value count at row 1 From
I'm getting this error: error on line 4 at column 1: Extra content at
I am getting this error Column count doesn't match value count at row 1
I am getting this nullable column error message in Entity Framework 4.1 - when
I am getting this error message while creating table with one of the column
I keep getting this error: Error saving identity in IdentityDaoImpl. Reason: org.hibernate.PropertyValueException: not-null property
I'm getting this error on my production environnent: (from prod.log) [2012-01-30 17:00:51] request.CRITICAL: Doctrine\ORM\Mapping\MappingException:

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.