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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:53:52+00:00 2026-06-08T21:53:52+00:00

As the title suggests I am getting the ‘Column count doesn’t match value count

  • 0

As the title suggests I am getting the ‘Column count doesn’t match value count at row 1’ error. After comparing the values I want to send to database with my database and did not find a mistake, I looked over the internet and tried various solutions. None of them worked so far. I also tried to use SET instead of VALUES. Like ‘Passwort’ = ‘$passwort’ – Also did not do the trick. Here is my code, maybe someone spots an obvious mistake that I missed?

 $name = ($_GET["name"]);
 $sql = "INSERT INTO $DB_Table VALUES('$name')";

 $passwort = ($_GET["passwort"]);
 $sql = "INSERT INTO $DB_Table VALUES('$passwort')";

 $con = mysql_connect($DB_HostName,$DB_User,$DB_Pass) or die (mysql_error()); 
 mysql_select_db($DB_Name,$con) or die(mysql_error()); 
 mysql_set_charset('utf8', $con);

 mysql_query("INSERT INTO $DB_Table (Name,Passwort) VALUES ('$name','$passwort')");
 $res = mysql_query($sql,$con) or die(mysql_error());
 mysql_close($con);
if ($res) {
    echo "Der Benutzer wurde neu angelegt!";
}else{
    echo "Der Benutzername ist bereits vergeben";
}
  • 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-08T21:53:54+00:00Added an answer on June 8, 2026 at 9:53 pm
    $sql = "INSERT INTO $DB_Table VALUES('$name')";
    
    $sql = "INSERT INTO $DB_Table VALUES('$passwort')"; 
    

    Here you just overwritten the previous variable, so what’s the point of having the previous one?

    And then you’re trying to execute the query, which will fail, as the table has more columns.

    $res = mysql_query($sql,$con) or die(mysql_error());
    

    I don’t even know why you’re trying to do this, as the previous line already did the insert. Did you meant to do this? :

    $sql = "INSERT INTO $DB_Table (Name,Passwort) VALUES ('$name','$passwort')");
    $res = mysql_query($sql,$con) or die(mysql_error());
    

    That all said, your code is vulnerably to SQL injection attacks, and it’s using a the old mysql interface.

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

Sidebar

Related Questions

As the title suggests, I am getting a FileNotFoundException when running a web page
I'm having real trouble getting my head around this issue. As the title suggests,
I am trying to do as the title suggests, however I am getting confused.
As the title suggests - I have a value in my viewmodel that is
As title suggests I want to know the difference between the change and click
As the title suggests, how do I get the number of views / clicks
As the title suggests, I would like to get the last word out of
As the title suggests, I was wondering how to concat two fields in a
So as the title suggests I wish to create a new dom element (the
As the title suggests I am looking for a open source ERP package. While

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.