C
the error message: Column count doesn't match value count at row ... occurs when the number of columns of the insert and those indicated in the part of VALUES It doesn't match.If you write the identified instruction, and the grouped columns of 10 in 10 you can quickly see the error.This is the identified consultation:INSERT into productos
(
fecha,
semipura,
pura_extra,
picada,
pura_normal,
pura_8020,
pura_100,
libreada_500gr,
libreada_250gr,
libreada_125gr,
crema_500gr,
crema_250gr,
crema_125gr,
suero_220gr,
andiponque,
hojaldre,
oleofree,
m_8020,
artepan,
m_de_cerdo,
aceite_bidon, -- no se está pasando VALUE para esta columna
roscon,
miloja,
caneca,
piña_kl,
piña_lb,
piña_5lb,
breva,
veleño,
coberturas,
grajeas,
bocadillo,
lonja,
esencia,
e_garrafa,
coco_angel,
coco_azucarado,
fruta,
polvo_hornear,
azucar_pulverizada
)
VALUES
(
'$fecha',
'$semipura',
'$pura_extra',
'$picada',
'$pura_normal',
'$pura_8020',
'$pura_100',
'$libreada_500gr',
'$libreada_250gr',
'$libreada_125gr',
'$crema_500gr',
'$crema_250gr',
'$crema_125gr',
'$suero_220gr',
'$andiponque',
'$hojaldre',
'$oleofree',
'$m_8020',
'$artepan',
'$m_de_cerdo',
-- aquí falta valor para columna aceite_bidon
'$roscon',
'$miloja',
'$caneca',
'$piña_kl',
'$piña_lb',
$piña_5lb,
$breva,
$veleño,
$coberturas,
$grajeas,
$bocadillo,
$lonja,
$esencia,
$e_garrafa,
$coco_angel,
'$coco_azucarado',
'$fruta',
'$polvo_hornear',
'$azucar_pulverizada'
)
Now observe the third group of ten, in the part of VALUES, there you are not passing data for the column aceite_bidon. The code doesn't see any data that recovers from $_POST for that column.Another possible problem is that in some VALUE You're not using simple quotes, I don't know if in the table those values are numerical and that's why you omitted the simple quotes? Such is the case of values $piña_5lb and others in the second half of the third dozen values, and the first values of the fourth ten, as $grajeas and others.Correcting that, the code should work, except for other mistakes.RecommendationsAs a recommendation, consider applying the use of prepared consultations, as your code is vulnerable to attacks of SQL injection.Also, seeing the nature of INSERT It is likely that a deep standardization of your data model will be needed, but that already exceeds the scope of this question.