dimanche 21 février 2016

The data insertion INSERT INTO not working in my php script

I have developed a software but suddenly got that the data insertion using INSERT INTO is not working. I dont know why it happened. Here is the code piece given below:

<?php

$servername = "localhost";
$username = "root";
$password = "";
$dbname = "booking";

$conn = new mysqli($servername, $username, $password, $dbname);
if($conn->connect_error){die("Connection failed: ". $conn->connect_error);}

$sql = "INSERT INTO data (CNIC) VALUES ('37105458742-5')";


if(mysqli_query($conn, $sql) {echo("Success");}


?>

The database connection is successful. On the line 14 $sql = "INSERT..... gives error:

Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\booking\index.php on line 14




Aucun commentaire:

Enregistrer un commentaire