-2

When I try to insert mysql rows i get this error: I found this code at: www.w3schools.com/php/php_mysql_insert.asp

Parse error: syntax error, unexpected T_VARIABLE in C:\xampp\htdocs\enviar.php on line 17

This is the code:

<?php
                $servername = "localhost";
                $username = "*****";
                $password = "*****";
                $dbname = "*******";

$produto = $_REQUEST['produto'];
$mesa  = $_REQUEST['mesa'];
$conc = "fila"

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
// Send information to mysql
$sql = "INSERT INTO lanchesystem ( Produto, Mesa, conc)
VALUES ('$produto', '$mesa', '$conc')";

if ($conn->multi_query($sql) === TRUE) {
    echo "Pedido Concluído!";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
// Close connection
$conn->close();
?>

How to solve this??

chris85
  • 23,846
  • 7
  • 34
  • 51
  • very low quality question (poor title and no effort) and will serve nobody. asked too many times. – Funk Forty Niner Oct 26 '15 at 20:41
  • Why are you using `multi_query`? That with your current SQL usage can drop your whole db, manipulate any query anything. 1. Don't pass user input directly to your SQL. 2. Don't use unknown functions, there is a reason/usage for each function. 3. When getting an error check the reported line number. http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php?rq=1 – chris85 Oct 26 '15 at 20:44
  • Use [prepared statements](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) so your database doesn't get a royal dump on it. – Drew Oct 26 '15 at 20:50
  • 1
    @Drew Fit for a Queen huh? Silver-laced toilet paper too? – Funk Forty Niner Oct 26 '15 at 20:52
  • *....rattle & roll* - @Drew – Funk Forty Niner Oct 26 '15 at 20:58

1 Answers1

0

Add a semicolon:

$conc = "fila";

I also recommend using a text editor with a linter. It'll save you some time and headache.

wogsland
  • 9,106
  • 19
  • 57
  • 93