Hello,
I'm getting an error "Column count doesn't match value count at row 1"
<?
include("db.php");
$ClientsName=$_POST['client'];
$PrgNo=$_POST['prgno'];
$PrgName=$_POST['prgname'];
$TrainerName=$_POST['trainer'];
$Dates=$_POST['dates'];
$Days=$_POST['days'];
$ProfFee=$_POST['fee'];
$TrainerFee=$_POST['trainerfee'];
$ReimbExp=$_POST['rexp'];
$HandoutChg=$_POST['handchg'];
$InvoiceNo=$_POST['invno'];
$TotalInvAmt=$_POST['invamt'];
$FeeRecd=$_POST['feerec'];
mysql_connect($host,$username,$password);
@mysql_select_db($database) or die("Unable to connect to db");
$query = "INSERT INTO tcg VALUES('$ClientsName','$PrgNo','$PrgName','$TrainerName','$Dates','$Days','$ProfFee','$TrainerFee','$ReimbExp','$HandoutChg','$InvoiceNo','$TotalInvAmt','$FeeRecd')";
mysql_query($query) or die(mysql_error());
mysql_close();
echo "Data inserted successfully.";
?>
<a href="insert.html">Insert More</a>
This is the code I'm using.
Database name is vimal_tcg and the table name is also tcg, is this a problem?
First I tried using eg : $client=$_POST and so on. it gave the same error. I thought it might be a problem because the columns are named differently and I changed $client=$_POST to $ClientsName=$_POST and so on.
Even after changing the variables to the ones according to the table in database it gives the same error.
And the fields in the insert.html , insert.php (above code) and the table are 13.
There is one more column in table SlNo which is put to primary unique and auto increment . And ClientsName column is set to INDEX.
Please help.