Jump to content

Column count doesn't match value count at row 1... sorrryyy


CircularStopSign

Recommended Posts

alright, this is really starting to frustrate me... now it says "Column count doesn't match value count at row 1" when i try to register

this is my regiser.php:

[code]
<?

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email_address = $_POST['email_address'];
$password = $_POST['password'];
$repassword = $_POST['repassword'];

$first_name = stripslashes($first_name);
$last_name = stripslashes($last_name);
$email_address = stripslashes($email_address);$password = stripslashes($password);
$repassword = stripslashes($repassword);

if((!$first_name) || (!$last_name) || (!$email_address)){
    echo 'You did not submit the following required information! <br />';
    if(!$first_name){
        echo "First Name is a required field. Please enter it below.<br />";
    }
    if(!$last_name){
        echo "Last Name is a required field. Please enter it below.<br />";
    }
    if(!$email_address){
        echo "Email Address is a required field. Please enter it below.<br />";
    }
    if(!$password==repassword){
        echo "Passwords are not the same.<br />";
    }
    include 'join_form.html';
    exit();
}
   
# does this user already exist in the database? lets check for that now...
$sql_email_check = mysql_query("SELECT email_address FROM users WHERE email_address='$email_address'");


$email_check = mysql_num_rows($sql_email_check);

    if($email_check > 0){
        echo "<strong>Your email address has already been used by another member in our database. Please use a different Email address!";
        unset($email_address);


    include 'join_form.html';
    exit();
}


$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, password,  signup_date, decrypted_password)
        VALUES('$first_name', '$last_name', '$email_address', '$db_password',now())") or die (mysql_error());

if(!$sql){
    echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
    $userid = mysql_insert_id();
    // Let's mail the user!
    $subject = "Your Membership at mywebsite.com";
    $message = "Dear $first_name $last_name,
    You are now registered at our website, http://www.mywebsite.com!
   
    To activate your membership, please login here: http://www.patall8.100webspace.net/login_form.html
   
    Once you activate your membership, you will be able to login with the following information:
    Password: $password
    Please keep this username and password in a location that is easily accessible by you.
   
    Thanks!
    Pat
   
    This is an automated response, please do not reply!";
   
    mail($email_address, $subject, $message, "From:    <mr.monicaclinton@gmail.com@>\nX-Mailer: PHP/" . phpversion());
    echo 'Your membership information has been mailed to your email address! Please check it and follow the directions!';
}
?>
[/code]

and my mySQL query contains:
userid
first_name
last_name
email_address
password
signup_date
activated
decrypted_password


sorry for asking for so much help but ive been trying to figure it out for a couple hours now
Link to comment
Share on other sites

[quote]$sql = mysql_query("INSERT INTO users (first_name, last_name, email_address, password,  signup_date, decrypted_password)
        VALUES('$first_name', '$last_name', '$email_address', '$db_password',now())") or die (mysql_error());[/quote]

Count the column names in

(first_name, last_name, email_address, password,  signup_date, decrypted_password)

then count the values in

('$first_name', '$last_name', '$email_address', '$db_password', now())
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.