I have stared the work to insert the data in the database from php file. Database connection is established successfully but data is not inserted in the database. Some sort of error like "Error: Column count doesn't match value count at row 1" occurs.
Our database name is request_license, table name is user_data and the field names in the database are First_Name, Last_Name, Name_Of_Organization, Email, Contact_number, Duration_In_Years, MAC_Address, CPU_ID, Motherboard_ID
php code
<?php
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("request_license", $con);
echo "connection establish";
$sql="INSERT INTO user_data (First_Name, Last_Name, Name_Of_Organization,Email,Contact_number,Duration_In_Years,MAC_Address,CPU_ID,Motherboard_ID)
VALUES
('$_POST[fname]','$_POST[lname]','$_POST[Oname]','$_POST[email]','$_POST[cno]','$_POST[years]''$_POST[mid]','$_POST[cid]','$_POST[mbid]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
html code
<html>
<body bgcolor="#FFB6C1">
<form action="insert.php" method="post">
<h1>
<font size="15" face="Monotype Corsiva" color="black">
<center>ID Technologies</center></font></h1>
<form>
<table>
<tr>
<td width="50%"> First Name: </td>
<td> <input type="text" name="fname" /> </td>
</tr>
<tr>
<td width="50%"> Last Name :</td>
<td> <input type="text" name="lname" /></td>
</tr>
<tr>
<td width="50%"> Organization Name:</td>
<td> <input type="text" name="oname"/></td>
</tr>
<tr>
<td width="50%">Email:</td>
<td><input type="text" name="email" /></td>
</tr>
<tr>
<td width="50%">Contact Number:</td>
<td><input type="text" name="cno" /></td>
</tr>
<tr>
<td width="50%">Duration in years:</td>
<td><input type="text" name="years"/ ></td>
</tr>
</table>
<br/>
<input type="radio"/>Extend<br/>
<input type="radio"/>Read Only<br/><br/>
<table>
<a href="application.exe">Download link</a>
</br></br>
<tr>
<td width="50%">MAC ID:</td>
<td><input type="text" name="mid" /></td>
</tr>
<tr>
<td width="50%">CPU ID:</td>
<td><input type="text" name="cid" /></td>
</tr>
<tr>
<td width="50%">MotherBoard ID:</td>
<td><input type="text" name="mbid" /></td>
</tr>
</table>
</br></br>
<input type="submit" value="Submit Data"/>
</form>
</body>
</html>
Please help me why this error occurs.....