Problems saving information in a database column

2

I need to get 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 select the player in the combobox I would already be able to assign the score to the player selected in the combobox.

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

What am I doing wrong?

    
asked by anonymous 15.09.2015 / 19:44

2 answers

0

You have failed to specify the name of the columns as the new value and what the condition column is.

change:

UPDATE jogador SET $pont WHERE cmbjogador

To

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

Do not 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());
    
15.09.2015 / 19:50
1

You forgot to pass the table field in the query

$sql = mysql_query("UPDATE jogador SET campoTabela=$pont WHERE cmbjogador= $id );
    
15.09.2015 / 19:51