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
?>
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
?>