Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

mysql error

Options
  • 02-02-2005 6:50pm
    #1
    Registered Users Posts: 4,478 ✭✭✭


    Column count doesn't match value count at row 1

    im getting this error as i attempt to add to a db. heres the sql

    $query ="insert into students (stu_id,username, password, first_name, last_name, add1, add2, add3, country, email, phone, dob, gender, destination, college,
    course, year, year_grad, date_arrive, date_depart, ssn_status, name_last_employer, position_last_employer, duties_last_employer, duration_last_employer,
    contact_last_employer, name_prev_employer, position_prev_employer, duties_prev_employer, duration_prev_employer, contact_prev_employer, contact_emp, blacklisted, reg_date)

    values('','$username',PASSWORD('$pw'), '$fn','$ln','$add1','$add2''$add3','$country','$email','$phone','$dob','$gender','$destination','$college'
    ,'$course','$year','$yeargrad','$date_arrive','$date_depart','$ssnstatus','$namele','$posle','$dutiesle','$durationle','$contactle',
    '$namepe','$positionpe','$dutiespe','$durationpe','$contactpe','$contactperm','$no',NOW())";

    ive been googling and i think the problem is stu_id its set to auto increment. i removed it and its value from the sql and got the same error.

    any help appreciated as im a complete newbie to mysql


Comments

  • Registered Users Posts: 3,886 ✭✭✭cgarvey


    You need a comma between '$add2''$add3'


  • Registered Users Posts: 7,412 ✭✭✭jmcc


    values('','$user
    
    W())";
    

    You also have a set of unnecessary " in there as well.

    Regards...jmcc


  • Registered Users Posts: 4,478 ✭✭✭wheres me jumpa


    thanks for your help guys. found a lot of mistakes in it afterwards!


  • Registered Users Posts: 7,412 ✭✭✭jmcc


    thanks for your help guys. found a lot of mistakes in it afterwards!
    If it is a php query, the last " may be necessary but the one at the start of values( is not.

    Regards...jmcc


Advertisement