nishmgopal Posted March 17, 2009 Share Posted March 17, 2009 Hi guys, I am trying to insert some fields into my table, and I am getting the following error: Column count doesn't match value count at row 4 Here is my code: <?php session_start(); if(isset($_SESSION['Job_ID'])) { echo $_SESSION['Job_ID']; } else { echo 'Job ID Not Set.';} ?> $skill1 = $_POST['skill1']; $weight1 = $_POST['weight1']; $skill2 = $_POST['skill2']; $weight2 = $_POST['weight2']; $skill3 = $_POST['skill3']; $weight3 = $_POST['weight3']; $skill4 = $_POST['skill4']; $weight4 = $_POST['weight4']; $skill5 = $_POST['skill5']; $weight5 = $_POST['weight5']; $skill6 = $_POST['skill6']; $weight6 = $_POST['weight6']; if (isset($_POST['addmore'])) { # THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE $sql = "INSERT INTO conmg.ID_Table (ID, Job_ID, Skill_Name, Weight) VALUES ('', '$_SESSION[Job_ID]', '$skill1', '$weight1'),('', '$_SESSION[Job_ID]', '$skill2', '$weight2'), ('', '$_SESSION[Job_ID]', '$skill3', '$weight3'), ('', '$_SESSION[Job_ID]' '$skill4', '$weight4'), ('', '$_SESSION[Job_ID]', '$skill5', '$weight5'), ('', '$_SESSION[Job_ID]', '$skill6', '$weight6')"; if($result = mysql_query($sql)) { echo "The Project Database has been Updated"; } else { echo "ERROR: ".mysql_error(); } } ?> Can anyone help? Link to comment https://forums.phpfreaks.com/topic/149883-solved-insert-into-tableweird-error/ Share on other sites More sharing options...
Mchl Posted March 17, 2009 Share Posted March 17, 2009 ('', '$_SESSION[Job_ID]' '$skill4', '$weight4'), Missing comma here Link to comment https://forums.phpfreaks.com/topic/149883-solved-insert-into-tableweird-error/#findComment-787112 Share on other sites More sharing options...
nishmgopal Posted March 17, 2009 Author Share Posted March 17, 2009 thank you very much Link to comment https://forums.phpfreaks.com/topic/149883-solved-insert-into-tableweird-error/#findComment-787126 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.