Page 1 of 1
Parse error on a line that doesn't exist..
Posted: Wed Nov 26, 2003 10:42 pm
by d3ad1ysp0rk
Code: Select all
<?PHP
if($_POST['act']=="process" && isset($_POST['username']) && $_POST['password']==$_POST['password2'] && isset($_POST['email']))
{
$dbuser="*****";
$dbpass="*****";
$dbname="****";
$dbconnect=mysql_connect(localhost,$dbuser,$dbpass) or die("Unable to connect.");
mysql_select_db($dbname) or die("Unable to select database");
$isql = "INSERT INTO `newtable` (username, password, email) VALUES ($username, $password, $email)";
mysql_query($isql);
}
else
{
echo <<<EOT
<html>
<head>
<title>Register</title>
</head>
<body>
<form action="register.php" method="post" name="registerform">
Email Address: <input type="text" name="email"><br>
Username: <input type="text" name="username"><br>
Password: <input type="text" name="password"><br>
Password Again: <input type="password" name="password2"><br>
<input type="submit" value="Register!" name="submit2">
</form>
</body>
</html>
EOT;
}
?> //line 31
Parse error: parse error in /home/des404/public_html/lscript/register.php on line 32
anyone?? im guessing it's easy since it's a parse error, but i need an extra set of eyes for this..
thanks
Posted: Wed Nov 26, 2003 11:49 pm
by lc
Can't see an error in the regular php but what is that EOT thing??? I've never seen it before???
Posted: Thu Nov 27, 2003 12:14 am
by infolock
Posted: Thu Nov 27, 2003 2:05 am
by Nay
Maybe this:
Code: Select all
$dbconnect=mysql_connect(localhost,$dbuser,$dbpass) or die("Unable to connect.");
localhost is not a variable, so you'll still need the quotes. Fix:
Code: Select all
$dbconnect=mysql_connect("localhost",$dbuser,$dbpass) or die("Unable to connect.");
-Nay
Posted: Thu Nov 27, 2003 2:27 am
by twigletmac
You've got spaces / a tab before the end of the heredoc (EOT;), and that could cause the error.
Mac
Posted: Thu Nov 27, 2003 3:15 am
by JayBird
As twigletmac said:
Quote from manual
It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs after or before the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by your operating system. This is \r on Macintosh for example.
If this rule is broken and the closing identifier is not "clean" then it's not considered to be a closing identifier and PHP will continue looking for one. If in this case a proper closing identifier is not found then a parse error will result with the line number being at the end of the script.
Mark