Page 1 of 1

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

Posted: Tue Apr 13, 2004 1:58 pm
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>	
}
?>

Posted: Tue Apr 13, 2004 2:04 pm
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

Posted: Tue Apr 13, 2004 2:06 pm
by bironeb
Woops, I see it now... Thanks