I wrote a script that collects data from a form and it should submit the data to my database but i’m getting some error … syntax error to be specific :
"Parse error: syntax error, unexpected ‘$name’ (T_VARIABLE) in C:\wamp\www\airtime reversal\queue.php on line 26"
but after going through my code i cant seem to see whats wrong with it. Help?!
<?php
$servername = "localhost:3306";
$username = "root";
$password = "";
$db_name = "reverse airtime";
#making a connection
$link = mysqli_connect($servername, $username, $password, $db_name);
if(!$link){
die('could not connect: '.mysqlerror());
}
else {
echo "connection successfull";
}
#escaping the input from the form
$name = mysqli_real_escape_string($link,$_POST['name']);
$email = mysqli_real_escape_string($link,$_POST['email']);
$mobile = mysqli_real_escape_string($link,$_POST['mobile']);
$amount = mysqli_real_escape_string($link,$_POST['amount']);
#query
$sql = "INSERT INTO 'queue' ('name','email','mobile','amount') VALUES ("$name,$email,$mobile,$amount") ";
if (mysqli_query($link, $sql)){
echo "added successfully";
#adds records to queue database
} else {
echo "Error: ".$sql. "<br>".mysqli_error($link);
}
#closing connection
mysqli_close($link);
?>
The error is found around the line on my sql query