Insert Into Table...weird error
Posted: Tue Mar 17, 2009 3:35 pm
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:
Can anyone help?
Column count doesn't match value count at row 4
Here is my code:
Code: Select all
<?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();
}
}
?>