Hello everyone,

I have been trying to create a .php page to catch information from a form and insert it into our local database. Normally I am able to catch the parse errors but this one points straight to the end of my code:

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
<?php
$ln=$_POST['Last Name'];
$fn=$_POST['First Name'];
$mi=$_POST['Middle Initial'];
$ad=$_POST['Address'];
$ci=$_POST['City'];

$query = "INSERT INTO player VALUES
('','$ln','$fn','$mi','$ad','$ci');

mysql_query($query);

mysql_close();
?>  <----bad line 18

I am pretty sure the require once and include .php pages are correct as we have been using them without problems for a few months. Any ideas as to why the parser would point to line 18?

Recommended Answers

All 6 Replies

You forgot your closing " on $query

a question does

<? line; ?>
<? line; ?>

etc
take more processor than

<? line;
line;
line;
line; ?>

Hello everyone,

I have been trying to create a .php page to catch information from a form and insert it into our local database. Normally I am able to catch the parse errors but this one points straight to the end of my code:

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
<?php
$ln=$_POST['Last Name'];
$fn=$_POST['First Name'];
$mi=$_POST['Middle Initial'];
$ad=$_POST['Address'];
$ci=$_POST['City'];

$query = "INSERT INTO player VALUES
('','$ln','$fn','$mi','$ad','$ci');

mysql_query($query);

mysql_close();
?>  <----bad line 18

I am pretty sure the require once and include .php pages are correct as we have been using them without problems for a few months. Any ideas as to why the parser would point to line 18?

$query = "INSERT INTO player VALUES
('','$ln','$fn','$mi','$ad','$ci')"; <---------------quote here

maybe you forgot the closing quotation (") in your $query

The error is a missing quote mark.

<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php include("includes/header.php"); ?>
<?php
$ln=$_POST;
$fn=$_POST;
$mi=$_POST;
$ad=$_POST;
$ci=$_POST;

$query = "INSERT INTO player VALUES
('','$ln','$fn','$mi','$ad','$ci');

mysql_query($query);

mysql_close();
?> <----bad line 18

The ?> isnt actually where the error is occuring. Php is reading the code and doesnt stop until the end (?>). Even then it doesnt find the quote it wants so therefore it creates a parse error.

Hope this helps

The error is a missing quote mark.


The ?> isnt actually where the error is occuring. Php is reading the code and doesnt stop until the end (?>). Even then it doesnt find the quote it wants so therefore it creates a parse error.

Hope this helps

Thank you! That resolved it for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.