Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 23 August 2006 - 12:04 AM

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:

<?

$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!';
}
?> 

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


#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 23 August 2006 - 12:08 AM

$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());


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())
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 CircularStopSign

CircularStopSign
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts

Posted 23 August 2006 - 12:13 AM

oh... i understand now.. but i dont know how to fix it?

#4 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 23 August 2006 - 12:15 AM

Supply a value for decrypted_password
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users