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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

mysql error

  • 02-02-2005 5:50pm
    #1
    Registered Users, Registered Users 2 Posts: 4,479 ✭✭✭


    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, Registered Users 2 Posts: 3,889 ✭✭✭cgarvey


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


  • Registered Users, Registered Users 2 Posts: 7,521 ✭✭✭jmcc


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

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

    Regards...jmcc


  • Registered Users, Registered Users 2 Posts: 4,479 ✭✭✭wheres me jumpa


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


  • Registered Users, Registered Users 2 Posts: 7,521 ✭✭✭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