0

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?

5
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by Designer_101
0

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

0

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

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.