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

?>

Options: ReplyQuote
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.1.3 32bit & 64bit)
<Apache 2.4.29/2.2.31> <PHP 7.2/7.1/7.0/5.6/5.5/5.4> <MySQL 5.7.19/5.6.39/5.5.28>
<MariaDB 10.2.14> <phpMyAdmin4.8.1> <MySQL Workbench 6.3.10>

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.