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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:37:52+00:00 2026-06-14T12:37:52+00:00

While updating my registration form verification PHP, I came across an error that I

  • 0

While updating my registration form verification PHP, I came across an error that I just cannot seem to fix:

Column count doesn’t match value count at row 1

I have looked through the code over and over again and I can’t seem to see anything wrong with it. PHP syntax and formatting checkers all seem to say the code is OK. I understand that this error comes up a lot, but I can’t see the similarity between my code and the code of others who received the same error.

<?
include "./includes/config.inc.php";

include $include_path."cc.inc.php";
include $include_path."banemails.inc.php";




$is_pre_registration = (isset($_REQUEST['pre_registration']) && $_REQUEST['pre_registration'] == "1") ? "1" : "";

$TIME = mktime(date("H")+$SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);
$NOWB = date("YmdHis",$TIME);
// --
if (!isset($_POST['auction_id']) && !isset($_GET['auction_id'])) {
    $auction_id = $_SESSION["CURRENT_ITEM"];
} else {
    $_SESSION["CURRENT_ITEM"]=intval($auction_id);
}
if (empty($_POST['action'])) {
    $action = "first";
}
#// Retrieve users signup settings
$query = "SELECT * FROM BPLA_usersettings";
$res_s = @mysql_query($query);
if(!$res_s){
    MySQLError($query);
    exit;
}else{
    $REQUESTED_FIELDS = unserialize(mysql_result($res_s,0,"requested_fields"));
    $MANDATORY_FIELDS = unserialize(mysql_result($res_s,0,"mandatory_fields"));
}



if ($_POST['action'] == "first") {

    if (empty($_POST['accounttype']) && $SETTINGS['accounttype'] == 'sellerbuyer') {
        $TPL_err = 1;
        $TPL_errmsg = $MSG_25_0137;
    } elseif (empty($_POST['TPL_nick'])) {
        $TPL_err = 1;
        $TPL_errmsg = $ERR_5030;
    } elseif (empty($_POST['TPL_password'])) {
        $TPL_err = 1;
        $TPL_errmsg = $ERR_5031;
    } elseif (empty($_POST['TPL_repeat_password'])) {
        $TPL_err = 1;
        $TPL_errmsg = $ERR_5032;
    } elseif (empty($_POST['TPL_email'])) {
        $TPL_err = 1;
        $TPL_errmsg = $ERR_5033;
    } else {
        if (strlen($_POST['TPL_nick']) < 6) {
            $TPL_err = 1;
            $TPL_errmsg = $ERR_107;
        } else if (strlen ($_POST['TPL_password']) < 6) {
            $TPL_err = 1;
            $TPL_errmsg = $ERR_108;
        } else if ($_POST['TPL_password'] != $_POST['TPL_repeat_password']) {
            $TPL_err = 1;
            $TPL_errmsg = $ERR_109;
        } else if (strlen($_POST['TPL_email']) < 5) { // Primitive mail check
        $TPL_err = 1;
        $TPL_errmsg = $ERR_110;
        } elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$", $_POST['TPL_email'])) {
            $TPL_err = 1;
            $TPL_errmsg = $ERR_008;
        } elseif(BannedEmail($_POST['TPL_email'],$BANNEDDOMAINS)){
            $TPL_err = 1;
            $TPL_errmsg = $MSG_30_0054;
        } else {
            $sql = "SELECT nick FROM BPLA_users WHERE nick=\"" . AddSlashes ($_POST['TPL_nick']) . "\"";
            $res = mysql_query ($sql);
            if (mysql_num_rows($res) == 0) {
                $id = md5(uniqid(rand()));
                $id = eregi_replace("[a-f]", "", $id);

                $TPL_id_hidden = $id;
                $TPL_nick_hidden = $_POST['TPL_nick'];
                $TPL_password_hidden = $_POST['TPL_password'];
                $TPL_email_hidden = $_POST['TPL_email'];
            } else {
                $TPL_err = 1;
                $TPL_errmsg = $ERR_111; // Selected user already exists
            }

            $sql = "SELECT email FROM BPLA_users WHERE email=\"" . AddSlashes ($_POST['TPL_email']) . "\"";
            $res = mysql_query ($sql);
            if (mysql_num_rows($res) == 0) {
                $id = md5(uniqid(rand()));
                // $id = eregi_replace("[a-f]","",$id);
                $TPL_id_hidden = $id;
                $TPL_nick_hidden = $_POST['TPL_nick'];
                $TPL_password_hidden = $_POST['TPL_password'];
                $TPL_email_hidden = $_POST['TPL_email'];
            } else {
                $TPL_err = 1;
                $TPL_errmsg = $ERR_115; // E-mail already used
            }

            if ($TPL_err == 0) {
                $TODAY = $NOWB;
                # // #################################################################
                # // Users suspended field
                # // VALUES:
                # //        9 - sign up fee due
                # //         8 - no fee due, waiting for user's confirmation
                # //            1 - suspended by the administrator via admin utility
                # //
                $SUSPENDED = 8;
                if($SETTINGS['accounttype'] == 'sellerbuyer') {
                    $selected_accounttype = $_POST['accounttype'];
                } else {
                    $selected_accounttype = 'unique';
                }

                if($is_pre_registration != ""){
                    $user_pre_registration = "1";
                }else{
                    $user_pre_registration = "0";
                    //, is_pre_registration
                    //, ".intval($user_pre_registration)."
                }
                if($BPLowbidAuction_TESTMODE == 'yes') {
                     include "header.php";
                    echo "<strong>".$ERR_9999."</strong>";
                        include phpa_include("template_register.html");
                    exit();
                } else {
                $sql = "INSERT INTO BPLA_users (id,
                        nick, password, nletter,email, reg_date,
                        rate_sum,  rate_num,suspended,accounttype)
                          VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""
                      . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""
                        . (int)($_POST['TPL_nletter']) . "\", \""
                        . AddSlashes ($_POST['TPL_email']) . "\",
                      '$TODAY',
                      0,
                      0,
                      '$DATE',
                      '$SUSPENDED',
                      ENCODE(\"$MD5_PREFIX\"))";
                $res = mysql_query ($sql);
                if ($res == 0) {
                    $TPL_err = 1;
                    $TPL_errmsg = mysql_error (); //"Error updating users data";
                } else {
                    $TPL_id_hidden=mysql_insert_id();
                    # // ===========================================================
                    # // Added by Gian for IP banning
                    # // Store user IP address in the database
                    # // ===========================================================
                    $query = "INSERT INTO BPLA_usersips VALUES(
                              NULL,
                              ".intval($TPL_id_hidden).",
                              '".$_SERVER["REMOTE_ADDR"]."',
                              'first','accept')";
                    $res___ = @mysql_query($query);
                    if (!$res___) {
                        MySQLError($query);
                        exit;
                    }
                    # // ===========================================================
                    /**
                    * Update column users in table BPLA_counters
                    */
                    $query = "UPDATE BPLA_counters SET inactiveusers=inactiveusers+1";
                    $counteruser = mysql_query($query);
                    if (!$counteruser) {
                        MySQLError($query);
                        exit;
                    }
                    # // ===========================================================
                    /**
                    * Set up the language of this user in table BPLA_userslanguage
                    */
                    $language = $SETTINGS['defaultlanguage'];
                    $_SESSION['language'] = $language;
                    $userlanguage = mysql_query("INSERT INTO BPLA_userslanguage VALUES(
                                         '".$TPL_id_hidden."',
                                         '$language')");
                    if (!$userlanguage) {
                        MySQLError($query);
                        exit;
                    }
                    # // Send confirmation e-mail message depending on the peyment settings
                    #// and the signup confirmation settings
                    //if ($SETTINGS['signupfee'] != 1) {
 //                       if(($SETTINGS['usignupconfirmation'] == 'y' && $SETTINGS['accounttype'] == 'unique') || 
 //                          (($SETTINGS['sbsignupconfirmation'] == 's' || $SETTINGS['sbsignupconfirmation'] == 'sb') && $_POST['accounttype'] == 'seller') ||
 //                          (($SETTINGS['sbsignupconfirmation'] == 'b' || $SETTINGS['sbsignupconfirmation'] == 'sb') && $_POST['accounttype'] == 'buyer')) {
                            #Suspend user
                    $query = "UPDATE BPLA_users SET suspended=0,reg_date=reg_date WHERE id=$TPL_id_hidden";
                    $RES__ = @mysql_query($query);
                    if (!$RES__) {
                        echo "KLSDHD";
                        //MySQLError($query);
                        exit;
                    } else {
                        # Send e-mail to the user and the admin                    
                        include $include_path."user_confirmation_needapproval.inc.php";                        
                    }
//                        }else{
//                            include $include_path."user_confirmation.inc.php";
 //                       }
                    //}
                }
                }
            } // if($TPL_err == 0)
        }
    }
}


include "header.php";
if (($action == "first" && count($_POST) == 0) || ($_POST['action'] == "first" && $TPL_err)) {
    include phpa_include("template_register.html");
}

if ($_POST['action'] == "first" && !$TPL_err) {
    # //
    include phpa_include("template_registered_php.html");
}
include "footer.php";
$TPL_err = 0;
$TPL_errmsg = "";
?>

Changed:

       $sql = "INSERT INTO BPLA_users (id,
                nick, password, nletter,email, reg_date,
                rate_sum,  rate_num,suspended,accounttype)
                  VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""
              . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""
                . (int)($_POST['TPL_nletter']) . "\", \""
                . AddSlashes ($_POST['TPL_email']) . "\",
              '$TODAY',
              0,
              0,
              '$DATE',
              '$SUSPENDED',
              ENCODE(\"$CC\",\"$MD5_PREFIX\"),
              '$_POST[TPL_exp_month]','$_POST[TPL_exp_year]','$_POST[TPL_card_owner]','$_POST[TPL_card_zip]',1)"

To:

$sql = "INSERT INTO BPLA_users (id,
                        nick, password, nletter,email, reg_date,
                        rate_sum,  rate_num,suspended,accounttype)
                          VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""
                      . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""
                        . (int)($_POST['TPL_nletter']) . "\", \""
                        . AddSlashes ($_POST['TPL_email']) . "\",
                      '$TODAY',
                      0,
                      0,
                      '$DATE',
                      '$SUSPENDED',
                      ENCODE(\"$MD5_PREFIX\"))";

Now receive 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 ‘))’ at line 10

  • 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-14T12:37:53+00:00Added an answer on June 14, 2026 at 12:37 pm

    This error occurs when the number of columns specified in an INSERT query does not match the number of values provided. For example:

    INSERT INTO mytable (col1, col2) VALUES ('val1');
    

    In the following line you list 10 columns (id, nick, password, nletter, email, reg_date, rate_sum, rate_num, suspended, accounttype) but 16 values.

    $sql = "INSERT INTO BPLA_users (id,
            nick, password, nletter,email, reg_date,
            rate_sum,  rate_num,suspended,accounttype)
              VALUES (NULL, \"" . Addslashes ($TPL_nick_hidden) . "\", \""
          . md5($MD5_PREFIX . Addslashes ($TPL_password_hidden)) . "\", \""
            . (int)($_POST['TPL_nletter']) . "\", \""
            . AddSlashes ($_POST['TPL_email']) . "\",
          '$TODAY',
          0,
          0,
          '$DATE',
          '$SUSPENDED',
          ENCODE(\"$CC\",\"$MD5_PREFIX\"),
          '$_POST[TPL_exp_month]','$_POST[TPL_exp_year]','$_POST[TPL_card_owner]','$_POST[TPL_card_zip]',1)";
    

    You need to list the column names that correspond to the following values:

    $_POST[TPL_exp_month]
    $_POST[TPL_exp_year]
    $_POST[TPL_card_owner]
    $_POST[TPL_card_zip]
    1
    

    VERY important: you should use prepared statements to prevent SQL injection. This is a very dangerous and sadly very common attack. See https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet

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

Sidebar

Related Questions

I came across a terrible error while updating my android ADT plugin in Eclipse
I came across a problem while updating a typed DataTable that has a primary
Just came across a problem while updating an existing app to iOS 6. in
Just installed the SDK and ADK. while updating, it gives the following error: unexpected
While updating a datatime column in a table from another table, i noticed that
While updating for loops to for-each loops in our application, I came across a
While updating a big json list, I'm getting the following error : 2012-04-01T09:34:00+00:00 app[run.1]:
try: html = urlopen('http://glbse.com/api/asset/' + asset.name) except: print 'error while updating the price of
While updating a DataTable to a SQL Server database I get the error message
Following error occurs while updating a particular data in my web application.I am using

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.