Need help with my php database submission script

Need help with my php database submission script
0.0 0


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?!


$servername = "localhost:3306";
$username = "root";
$password = "";
$db_name = "reverse airtime";

#making a connection
$link = mysqli_connect($servername, $username, $password, $db_name);
	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']);


$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

The error is found around the line on my sql query


What is the error?
Is it a php error or a sql error?
First guess without seeing is in your values sequence.
Echo the string so you can see what it looks like.
Also, im assuming amount is a string and not a number.

It should look like this format.

ISERT INTO tablename ("name","email","mobile","amount")VAlUES ("username","","555-555-5555","$100");


Yes the problem is in my sql sequence… its taken me long to reply ive been off for a while
…after escaping the input with “mysql_real_escape string()” its saying unexpected $variable when i try to pass it in the query …
I’ll try echo a value to see what happens if the error still occurs…
I’ve also seen someone use a different approach on some tutorial when escaping …instead of passing $POST[‘name’] as 2nd parameter they used $REQUEST[‘name’] , anyone know anything about this?