Hello, I am having the same problem. getting the message: Parse error: syntax error, unexpected $end in C:\wamp\www\World_Database.php on line 79
I am an absolute beginner. Could someone please help me sort this? thanks a ton in advance.
Here is my code.

<html><head><title>World Database</title></head>



$linkID1 = mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect to the MySQL server");

mysql_select_db("world", $linkID1) or die("Could not connect to the world database mixed$status");


<h1>World Database Web Interface</h1>

<form method="post" name="world_interface" action="<?php print $_SERVER["PHP_SELF"]?>">
<p><strong>Enter a city name to lookup:</strong>
<input name="City Lookup" type="text" >
<input name="Submit" type="submit" value="Lookup City" ></p>

if  ($_POST[Submit] == "Lookup City") {
	$CityName = mysql_real_escape_string($_POST[CityLookup]);
	$lookup_sql = "SELECT City.Name, Country.Code, Country.Name, District, City.Population FROM City, Country 
				WHERE City.CountryCode = Country.Code 
					AND City.Name = '$CityName'";
	$lookup_results = mysql_query($lookup_sql, $linkID1);
	list($city_name,$country_code,$country_name,$district,$population) = mysql_fetch_row($lookup_results);
	if  ($city_name) {
		print <<<END
		<form action="world_update.php" method="post" name="world_update">
		<table width="700" border="0" cellspacing="3" cellpadding="3">
  <th width="100" scope="col">
    <div align ="left">
	<strong>City Name</strong>
<th width = "579" scope = "col">  <div align ="left">
<input name="CityName" type="text" value="$city_name" >
  <tr><td><div align ="left"><strong>Coutnry</strong>/div></td><td><div align ="left"><select name="CountryCode" id="CountryCode"
		 $query = "SELECT DISTINCT Code, Name FROM Country ORDER BY Name";
$results = mysql_query($query, $linkID1);
while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {
	$results_code = $row[noparse]
	$results_name = $row[Name];
	if ($country_code == $results_code) {
		print "<option value=\"$results_code\" selected>$results_name</option>\n";
	} else  {
	print "<option value=\"$results_code\" >$results_name</option>\n";	
		print <<<END2

	<td><div align="left"><strong>District</strong></div></td>
	<td><div align="left"><input name="CityDistrict" type="text" id="CityDistrict" value="$district"></div></td>
	<td><div align="left"><strong>Population</strong></div></td>
	<td><div align="left"><input name="CityPop" type="text" value="$population"> 
	 <input name="Submit" type="submit" value="Update City">
		 <input name="Submit" type="submit" value="Delete City">
		 	 <input name="Submit" type="submit" value="Add City">
	} else {
		print "<p>The city does not exist in the database</p>";

Edited by Ezzaral: Added code tags. Please use them to format all code that you post.

5 Years
Discussion Span
Last Post by diafol

Use [ CODE ] tags!! Reading code through normal text is difficult.

Have you checked that all braces { } are closed? This message usually pops up when you forget to close a brace.

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.