Jump to content

[SOLVED] Column count doesn't match value count at row 1


AngN

Recommended Posts

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
Share on other sites

('$_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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.