parse error:syntax error, unexpected (T_VARIABLE) around line ... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

parse error:syntax error, unexpected (T_VARIABLE) around line ...

whats wrong with my php .. did this after escaping the strings from the form fields with mysqli_real_escape_string($conn, $POST['name']); #query $sql= " INSERT INTO queue ("name","email","number") VALUES ("$name","$email","$number") "; im getting the error above, why is my data not being inserted in the database?

25th Apr 2018, 5:11 PM
Antony O. Onyango
Antony O. Onyango - avatar
3 Answers
+ 3
Those 3 lines aren't on a single line. This causes PHP to treat them as different statements and says that there's a missing semicolon.
2nd May 2018, 3:09 AM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 2
Antony Otieno Onyango can you provide us with the full code?
2nd May 2018, 12:04 PM
Ben Allen (Njinx)
Ben Allen (Njinx) - avatar
+ 1
thanks.. so i fixed my $sql string and now idk whatsup.. its outputting my last lines of code on the screen instead of making a connection and submitting..but im not getting any error!!! i.e. mysqli_close($conn); why im i seeing this,its not returning any error but code and i dont see anything wrong on my syntax..
2nd May 2018, 7:29 AM
Antony O. Onyango
Antony O. Onyango - avatar