Parse Error in PHP script
Posted by: kdrymer (
Date: August 31, 2017 08:35PM

Hello all - I am new to the forum and to PHP coding. I have setup my WAMP stack and created the MySQL database. I am trying to run my html/php file on the localhost, but I am receiving the following error message:

Parse error: syntax error, unexpected 'connect' (T_STRING), expecting ']' in C:\wamp64\www\Newspaper_Directory\Newspaper3.php on line 5

Below is the code I am using to make the connectiong to the database, utilizing another php file which has the login information. I verified the spelling of my other file (connect-mysql.php) and I'm not seeing the incorrect syntax. Any help is appreciated, thanks!


if (isset($_POST['submitted])) {


$fname = $_POST['Name'];
$femail = $_POST['Email'];
$fcomment = $_POST['Comment'];
$fsubsciption = $_POST['Subscription'];
$sqlinsert = "INSERT INTO newspaper (Name, Email, Comment, Subscription) VALUES ('$fname',
'$femail', '$fcomment', '$fsubsciption')";

if (!mysqli_query($dbcon, $sqlinsert)) {
die('error inserting new record')

} // end of nested if statement

$newrecord = '1 record added to the database'

} // end of main if statement


Options: ReplyQuote
Re: Parse Error in PHP script
Posted by: RiggsFolly (Moderator)
Date: September 01, 2017 12:38AM


This site is for those having trouble getting WANPServer running.

It is not a PHP tutorial site.

(Windows 10 Pro 64bit) (Wampserver 3.1.8 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.16>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote

Sorry, only registered users may post in this forum.