2
I am running the following php code:
require_once "config.php";
$pagina = $_POST['pagina'];
$conteudo = $_POST['edit'];
//mysql_query("DELETE FROM $pagina WHERE 1") or die("alguma coisa deu errado".mysql_error());
//mysql_query("INSERT INTO $pagina (`conteudo`) VALUES ('$conteudo')");
mysql_query("UPDATE '$pagina' SET 'conteudo'='$conteudo' WHERE 1") or die("erro: ".mysql_error());
He says the syntax is wrong but I don’t see why, error print:
http://prntscr.com/2xx499
Or:
error: You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near '''home' SET 'conteudo'='asx' WHERE 1' at line 1
Now that I noticed: the query passes the table name into a variable
$pagina
, received by POST. This is not possible to parameterize in an appropriate way (see kaminari’s answer), indicates a strange structure, where each page is a table. If so, I recommend rethinking the structure of your bank.– bfavaretto