Jump to content

[SOLVED] Insert Into Table...weird error


nishmgopal

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.