[Solved]Parse error: parse error, unexpected $end

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
bironeb
Forum Commoner
Posts: 59
Joined: Thu Nov 20, 2003 12:02 pm

[Solved]Parse error: parse error, unexpected $end

Post by bironeb »

Im getting:

Parse error: parse error, unexpected $end on line 57

and the only thing on line 57 is ?> but line 57 is the last line:

Code: Select all

<?php
//assign the block to show to the $display_block variable
if ($show_form == "yes") {

	//build form block
	$display_block ="
	<h1>Login</h1>
		
	<form method=POST action="$_SERVER[PHP_SELF]">
	$msg	
	<P><strong>username:</strong><br>
	<input type="text" name="username" size=15 maxlength=25></P>
	
	<P><strong>password:</strong><br>
	<input type="password" name="password" size=15 maxlength=25></P>
	
	<input type="hidden" name="op" value="ds">
	
	<P><input type="submit" name="submit" value="login"></P>
	</FORM>";

} else if ($show_menu == "yes") {
	
	//set up table and database names
	$db_name ="Inventory";
	$table_name ="client_hardware";
	
	//connect to server and select database
	$connection = @mysql_connect("localhost","byron","byronb") or die(mysql_error());
	$db = @mysql_select_db($db_name,$connection) or die(mysql_error());
	
	//build and issue query
	$sql = "SELECT count(user_id) FROM $table_name";
	$result = @mysql_query($sql,$connection) or die(mysql_error());
	$count = @mysql_result($result,0,"count(user_id)") or die(mysql_error());
	
	//get current date
	$today = date("l,F jS,Y");
			
	//build menu block
	$display_block ="
	<p><em>Today is $today</em></p>
	<P><strong>Miscellaneous</strong></P>
	<ul>
	<li>Records in system: <strong>$count</strong>
	</ul>
	<P><strong>Inventory</strong><ul>
	<li><a href="index.php?main=show_addrecord" style="text-decoration:none">Add a Record</a>
	<li><a href="index.php?main=pick_modrecord" style="text-decoration:none">Modify a Record</a>
	<li><a href="index.php?main=pick_delrecord" style="text-decoration:none">Delete a Record</a>
	</ul>
	<P><strong>View Records</strong>
	<ul>
	<li><a href="index.php?main=show_recordsbyname" style="text-decoration:none">Ordered by user_name</a>
	</ul>	
}
?>
Last edited by bironeb on Tue Apr 13, 2004 2:06 pm, edited 1 time in total.
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

you failed to close the $display_block string - </a>"; should be at the end. It gave line 57 because as far as it knows, its still in the string, then suddenly it runs out of stuff to do before you close the else and give the closing ?> tag. That's as specific as it can get. So when you get that error, usually look for a missed closing quote
User avatar
bironeb
Forum Commoner
Posts: 59
Joined: Thu Nov 20, 2003 12:02 pm

Post by bironeb »

Woops, I see it now... Thanks
Post Reply