Specific cell change in MySQL

0

I'm trying to change a specific cell in MySQL using a form in PHP, but I can not do that and no error is shown so I can try to fix it, how can I fix the problem?

  

Logic

<?php

require("conecta.php");

$novoTituloDisciplina = $_POST["novo-titulo-disciplina"];
$valorDisciplina = $_POST["disciplina-a-alterar"];

$query = "update table disciplinas set 'nome_disciplina' = '{$novoTituloDisciplina}' where id = '{$valorDisciplina}'";

if(mysqli_query($conexao, $query)){
    mysqli_close();
    header("Location:../cadastra_novo.php");
}else{
    mysqli_close();
    header("Location:../index.php");
};
  

Form

<form action="logicas/logica-altera_disciplina.php" method="post">
    <div>
        <h3>Alterar Disciplina</h3>
    </div>
    <label>Disciplina</label>
    <select name="disciplina-a-alterar">
        <option disabled selected>-Selecione a disciplina-</option>
        <!-- Receber as opções disponíveis no banco de dados -->
        <?php
        $disciplinas = listagemDisciplinas($conexao);
        foreach ($disciplinas as $disciplina){
            ?>
            <option value="<?= $disciplina["id"] ?>"><?= $disciplina["nome_disciplina"] ?></option>
            <?php
        }
        ?>
    </select>
    <label>Novo nome</label>
    <input type="text" name="novo-titulo-disciplina">

    <button type="submit">Alterar</button>
</form>
    
asked by anonymous 10.07.2017 / 18:21

1 answer

2

The error is in your query , to execute an update does not need the word table , it would look like this:

$query = "update disciplinas set 'nome_disciplina' = '{$novoTituloDisciplina}' where id = '{$valorDisciplina}'";
    
10.07.2017 / 18:27