Jump to content

Archived

This topic is now archived and is closed to further replies.

CircularStopSign

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

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

Share this post


Link to post
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())

Share this post


Link to post
Share on other sites

×

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.