Solved

Simple page - but Syntax Error

Posted on 2002-04-29
2
182 Views
Last Modified: 2006-11-17
I'm a newbie - spent about 2 hours looking for the reason I get:
 
Parse error: parse error in /home/ag/netafimusa-www/PHP/AddPet.php3 on line 34

for the page:

<html>
<head>
<title>Add Pet</title>
</head>
<body>
Catalog:<br>
<ul>

<?php
  $user="ag";
  $host="localhost";
  $password="";
  $database = "netafimusa_com";

  $connection = mysql_connect($host,$user,$password)
       or die ("couldn't connect to server");
  $db = mysql_select_db($database,$connection)
       or die ("Couldn't select database");

$label_array = array ("LiteratureDescription" => "Literature Description");

//Loop through the values
foreach ($HTTP_POST_VARS as $key => $value)

//missing curly bracket

{
$query = "INSERT INTO tblLiteratureRequested
(LiteratureDescription) VALUES ('{$label_array["LiteratureDescription"]}');

                             

$result = mysql_query($query)
     or die ("Couldn't execute query.");

echo "The following pet has been added to the Pet
       Category: "$LiteratureDescription" ;

}
//Close the loop
?>
  <!-- Close your list and html -->
</ul>
</body>
</html>
0
Comment
Question by:aprillougheed
2 Comments
 
LVL 7

Accepted Solution

by:
axis_img earned 200 total points
ID: 6978968
Would this be the problem?

echo "The following pet has been added to the Pet
      Category: "$LiteratureDescription" ;

should be:

echo "The following pet has been added to the Pet Category: $LiteratureDescription";

You have an extra quote in there...

Let me know if the problem persists...
Barry
0
 

Author Comment

by:aprillougheed
ID: 6978984
I had found the error . . .  but thanks for your help.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question