AngN Posted September 11, 2007 Share Posted September 11, 2007 Hi I keep getting this message :- "Error: Column count doesn't match value count at row 1" The first row of the SQL table is job_id which is not null, auto increment I have tried the INSERT statement with and without the job_id Can anyone help please? <html> <body> <HEAD> <link rel="stylesheet" type="text/css" href="style_sheet.css" /> </HEAD> <form action="AddPosition.php" method="post"> <table border=1 width=90%> <tr> <th>Title <input type="text" name="title" /></th> <th>Employer<input type="text" name="employer" /></th> <th>Starting Date<input type="text" name="start_date" /></th> <th>Salary<input type="text" name="salary" /></th> <th>Required Years Experience<input type="text" name="req_exp" /></th> <th>Required Skills<input type="text" name="req_skills" /></th> </tr> <input type="submit" /> <hr> </form> <p> <?php // Connect to the database server mysql_connect("mysql.ict.school.edu.au", "123456", "password"); $connection = @mysql_connect ("mysql.ict.school.edu.au", "123456", "password"); if (!connection) { echo ( "<p>Unable to connect to the databasse server.<p>"); exit(); } // Select the database to be used mysql_select_db("123456", $sql); if (! @mysql_select_db ("123456db") ) { echo ( "<p>Unable to locate the database" . "database.<p>" ); exit(); } // If a position has been added, insert into the database $sql="INSERT INTO positions (job_id, title, employer, start_date, salary, req_exp, req_skills) VALUES ('$_POST[job_id]','$_POST[title]','$_POST[employer]''$_POST[start_date]''$_POST[salary]''$_POST[req_exp]''$_POST[req_akills]')"; if (!mysql_query($sql,$connection)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($connection) ?> Link to comment https://forums.phpfreaks.com/topic/68812-solved-column-count-doesnt-match-value-count-at-row-1/ Share on other sites More sharing options...
AndyB Posted September 11, 2007 Share Posted September 11, 2007 ('$_POST[job_id]','$_POST[title]','$_POST[employer]''$_POST[start_date]''$_POST[salary]''$_POST[req_exp]''$_POST[req_akills]')"; missing commas. It should be: ('$_POST[job_id]','$_POST[title]', '$_POST[employer]', '$_POST[start_date]', '$_POST[salary]', '$_POST[req_exp]'. '$_POST[req_akills]')"; Link to comment https://forums.phpfreaks.com/topic/68812-solved-column-count-doesnt-match-value-count-at-row-1/#findComment-345906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.