Problem inserting php mysql ID data

Asked

Viewed 674 times

0

I have a problem entering data in mysql due to table id.

Tb_details_worker: id, Name, Function

$sqlinsert = "INSERT INTO tb_detalhe_trabalhador VALUES ('','".$Nome1."','".$Funcao1."') 

Error: Column Count doesn’t match value Count at Row 1

Do I have to put the mysql fields after the table name?

  • and there worked the solution for you?

  • I’ve already found another kkk mistake

1 answer

1


Correct:

$sqlinsert = "INSERT INTO tb_detalhe_trabalhador(nome, funcao) VALUES ('".$Nome1."','".$Funcao1."')";

When there’s a field auto_increment, Insert does not need to inform you, but mandatory fields must be specified. This Insert that I showed you is a good practice, never let go of the fields.

  • The ID does not appear?

  • Your ID I’m guessing is auto_increment, because, you passed ''.

  • Yes Id is auto_increment.. But as you indicated, the same error still appears

  • Shows the structure of your table.

  • is show structure !!! @user3253195

Browser other questions tagged

You are not signed in. Login or sign up in order to post.