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>

<body>
<?php 

include"file:///D|/PHPMySQL/connect_info.php"; 

$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>
</form>
<?php 

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">
  <tr>
  <th width="100" scope="col">
    <div align ="left">
	<strong>City Name</strong>
</div></th>
<th width = "579" scope = "col">  <div align ="left">
<input name="CityName" type="text" value="$city_name" >
</div></th>
  </tr>
  <tr><td><div align ="left"><strong>Coutnry</strong>/div></td><td><div align ="left"><select name="CountryCode" id="CountryCode"
  </tr>
		 END;
		 $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]
[code]
[/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

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

Recommended Answers

All 6 Replies

Member Avatar for 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.

Change is as

}
}</form>
?>
</body></html>

to

}
	}
?>
</form>
</body></html>

divyakrishnan thanks! it works now :)

Member Avatar for diafol

mark it solved then.

sorry... how to do that?

mark it solved then.

Member Avatar for diafol

there's a link below the edit box. :)

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.