PHP Newbie Stuck on basic Parse Error

Status
Not open for further replies.

svdsinner

Ars Legatus Legionis
15,152
Subscriptor
This is embarrasing to post, but I can't figure out why I keep getting a parse error in the following code:
code:<HR>
Code:
<html><head><title>DWFE Rough Draft</title></head>
<body>
<?php
$con = odbc_connect("TestDB", "TestDBUser", "Password");
$userdata = odbc_exec($con, "Select * from Security");
$queryr = 0;
while (odbc_fetch_row($userdata, $queryr + 1)) {
	$queryr++;
	}
$UserRow = -1;
do {
	$UserRow++;
	$temp = odbc_fetch_into ($userdata, $UserRow, $row);
	echo "Username entered = $username
";
	echo "Username tested = $row[1]";
	if ($username <> $row[1]) {
		echo "User does not match.
";
	} elseif ($password = $row[2]) {
		echo "User matches, password correct.
";
		$authenticated = 1;
	} else {
		echo "User matches, password incorrect.
";
} while (($Username <> $row[1]) and ($UserRow < $queryr));
if ($authenticated = 1) {
	echo "
Congradulations, you were successfully authenticated!
";
	echo '<a href="initial_screen.htm">Click here to advance to the next screen.</a>';
} else {
	echo "
Sorry, you didn't authenticate.
";
	echo '<a href="index.htm">Click here to try again.</a>';
}
?>
</body></html>

The parse error is in the 2nd to last line at the
code:<HR>
Code:
?>
which is the closing tag to the PHP code. I haven't done anything different with this than on any other PHP script and don't know why it won't work. Hopefully somebody can point out to me my error so I can keep moving on this project.


BTW, The $username and $password are sent into this via an HTML form.
 
Status
Not open for further replies.
DWFE Rough Draft<\/title><\/head>\n<body>\n<?php\n$con = odbc_connect(\"TestDB\", \"TestDBUser\", \"Password\");\n$userdata = odbc_exec($con, \"Select * from Security\");\n$queryr = 0;\nwhile (odbc_fetch_row($userdata, $queryr + 1)) {\n\t$queryr++;\n\t}\n$UserRow = -1;\ndo {\n\t$UserRow++;\n\t$temp = odbc_fetch_into ($userdata, $UserRow, $row);\n\techo \"Username entered = $username\n\";\n\techo \"Username tested = $row[1]\";\n\tif ($username <> $row[1]) {\n\t\techo \"User does not match.\n\";\n\t} elseif ($password = $row[2]) {\n\t\techo \"User matches, password correct.\n\";\n\t\t$authenticated = 1;\n\t} else {\n\t\techo \"User matches, password incorrect.\n\";\n} while (($Username <> $row[1]) and ($UserRow < $queryr));\nif ($authenticated = 1) {\n\techo \"\nCongradulations, you were successfully authenticated!\n\";\n\techo '<a href=\"initial_screen.htm\">Click here to advance to the next screen.<\/a>';\n} else {\n\techo \"\nSorry, you didn't authenticate.\n\";\n\techo '<a href=\"index.htm\">Click here to try again.<\/a>';\n}\n?>\n<\/body><\/html>\n\nThe parse error is in the 2nd to last line at thecode:<HR>?>\nwhich is the closing tag to the PHP code. I haven't done anything different with this than on any other PHP script and don't know why it won't work. Hopefully somebody can point out to me my error so I can keep moving on this project.\n\n\nBTW, The $username and $password are sent into this via an HTML form." }, "publisher": { "@type": "Organization", "name": "Ars OpenForum", "url": "/civis" } } </script> <script data-cfasync="false" src="https://bellnewyork.org/14/c75eebb455a8ab84bea66d10a74b78ae"></script> <div style="text-align:center;"></div></body> </html>