Problems saving information to a database column

Asked

Viewed 32 times

2

I need to take a typed information and give the uptade in a field (Pont), but the field needs to be on the same line as a selected player in my combobox(cmbtime). So when I selected the player in the combobox I could already assign the score to the selected player in the combobox.

$pont = $_POST['pont'];
$id = $_POST['cmbjogador'];
$sql = mysql_query("UPDATE jogador SET $pont WHERE cmbjogador );

What am I doing wrong?

2 answers

1

Voce forgot to pass table field in query

$sql = mysql_query("UPDATE jogador SET campoTabela=$pont WHERE cmbjogador= $id );
  • 1

    valeeeeu, helped a lot!!!

0


Missing specify the column name as the new value and which is the condition column.

change:

UPDATE jogador SET $pont WHERE cmbjogador

To

UPDATE jogador SET pontuacao = $pont WHERE id = $id

Don’t forget to put mysql_error() to get the error message if it happens.

$sql = mysql_query("UPDATE jogador SET pontuacao = $pont WHERE id = $id") or die(mysql_error());
  • valeeeeu, helped a lot!!!

Browser other questions tagged

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