I have this function:
$id = pega_assunto_por_nome_menu($_GET['assunto'])['id'];
That returns the value of the id, if I use echo $id;
But when I do the update in mysql, it does not work.
This error appears:
You have an error in your SQL syntax; check the manual that correspond to your MySQL server version for the right syntax to use near '' at line 3
Line six is the definition of id = {$id};
$atualiza = "UPDATE assuntos SET
nome_menu = '{$nome_menu}'
WHERE id = {$id}";
If you use var_dump, this is the result.
$assunto = pega_assunto_por_nome_menu($_GET['assunto']);
var_dump($assunto);
array (size=10)
0 => string '1' (length=1)
'id' => string '1' (length=1)
1 => string 'Sobre a Preliminartes' (length=21)
'nome_menu' => string 'Sobre a Preliminartes' (length=21)
2 => string 'sobre_a_preliminarte' (length=20)
'nome_menu_slug' => string 'sobre_a_preliminarte' (length=20)
3 => string '1' (length=1)
'posicao' => string '1' (length=1)
4 => string '1' (length=1)
'visivel' => string '1' (length=1)