Lassie Posted September 21, 2007 Share Posted September 21, 2007 I have an input form with a number of variables. When I try to insert the values I get an error 'Column count doesnt match value count at row 1' I use the format INSERT INTO table (cols1,2,..) VALUES ('Value1',' Value2',) The first column in the table is the primary which is auto increment. The intial table structure is property_id V_id rci_ref country region etc Only the cols I am inserting are referenced in the query. Where am I going wrong. How do I debug this? $query = "INSERT INTO property (v_id,rci_ref,country,region,resort_name,unit_desc,unit_num,floor_type,ownership,floating, occ_wk ,booked,available,price,offers,trustees,description) VALUES ($v,'$rc','$ct','$rg','$rn','$tp','$un','$ft','$ow','$cl','$oc','$bk','$av','$p','$o','$t','$d')"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); Quote Link to comment https://forums.phpfreaks.com/topic/70178-column-count-error/ Share on other sites More sharing options...
Illusion Posted September 21, 2007 Share Posted September 21, 2007 remove the v_id from the columns list and the corresponding value. v_id for the first record is defaulted to 1. Quote Link to comment https://forums.phpfreaks.com/topic/70178-column-count-error/#findComment-352488 Share on other sites More sharing options...
mezise Posted September 23, 2007 Share Posted September 23, 2007 May you post CREATE TABLE for property table and result of print_r($query); ? Michal Quote Link to comment https://forums.phpfreaks.com/topic/70178-column-count-error/#findComment-353340 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.