0
personal I’m having a problem this error keeps appearing 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 '','daniel')' at line 1
<?php
$codigo = array_filter($_POST['codigo']);
foreach ($codigo as $key => $value) {
$codigo = $value;
$nome_pedido = $_POST["nome"][0];
$pedido = $_POST["pedido"][$key];
echo $codigo."<br>";
echo $nome_pedido."<br>";
echo $pedido."<br>";
$sql = "INSERT INTO pedidos VALUES";
$sql .="(NULL,'$codigo',$nome_pedido','$pedido')";
var_dump($sql);
if ($conn1 ->query($sql) === true){
echo " <div id=\"sucess-forn\" class=\"alert alert-success\" role=\"alert\" style=\"position: absolute; \n";
echo "top: 0; \n";
echo "left: 0; \n";
echo "z-index: 10; \n";
echo "padding:5px; \n";
echo "width:99%;\n";
echo " position: fixed; \">\n";
echo "<a class=\"close\" data-dismiss=\"alert\" href=\"#\">×</a>";
echo " <center><h1 class=\"alert-heading\">Fornecedor cadastrado com sucesso!</h1></center>\n";
echo "</div>\n";
} else {
echo "erro:". $sql . "<br>" . $conn1->error;
}
}
$conn1->close();
?>
someone could help me solve this problem and explain to me what is happening?
vlw my friend helped a lot
– Daniel Ricardo
That’s the correct answer.
– Augusto Vasques