Parse Error in PHP script
Posted by: kdrymer (---.stny.res.rr.com)
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!

<?php

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

include('connect-mysql.php');

$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

?>

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

Hi.

This site is for those having trouble getting WANPServer running.

It is not a PHP tutorial site.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

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 databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Sorry, only registered users may post in this forum.