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 7 Pro 32bit) (Wampserver 3.0.6 32bit)
<Apache 2.4.23/2.2.31> <PHP 7.1.2/7.0.16/5.6.28/5.5.38/5.4.45/5.3.29> <MySQL 5.7.10/5.6.17/5.5.28>
<MariaDB 10.1.21> <phpMyAdmin4.6.5.2> <MySQL Workbench 6.3.6.511>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin -- WAMPServer alternate Repo
-?-?-?- Backup your MySQL databases regularly Here is How dont regret it later! Yes even when developing -?-?-?-

Options: ReplyQuote


Sorry, only registered users may post in this forum.