i am getting error Parse error: parse error, unexpected T_E

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
deolsabh
Forum Newbie
Posts: 1
Joined: Mon Jun 16, 2003 7:15 pm

i am getting error Parse error: parse error, unexpected T_E

Post by deolsabh »

her are my code i dont know where i am wrong

<html>
<body>
<?
if (!isset($name)&&!isset($password))
{//Visitor needs to enter a name and password
?>
<h1>Please Log In</h1>
This page is for members only.
<form method = post action = "secretdb.php">
<table border = 1>
<tr>
<th> Username </th>
<td><input type = test name = name></td>
</tr>
<tr>
<th> Password </th>
<td><input type = password name = password></td>
</tr>
<tr>
<td colspan = 2 align = center >
<input type = submit value = "Log In">
</td>
</tr></table>
</form>
<?
{
else
}
// connect to mysql
$mysql = mysql_connect('localhost', 'webauth', 'webauth');
if (!$mysql)
{
echo 'Cannot connect to database.';
exit;
}
// select the appropriate database
$mysql = mysql_select_db ('auth');
if (!$mysql)
{
echo 'Cannot connect to database.';
exit;
}
//query the database to seeif there is a record which matches
$query = "select count(*) from auth where
name = '$name' and
pass = '$password'";
$result = mysql_query ($query) ;
if(!$result)
{
echo 'Connect run query.';
exit;
}

$count = mysql_result( $result, 0, 0 );

if( $count > 0 )
{
//visitor's name and password combination are correct
echo "<h1> Welcome </h1>";
}
else
{
//visitors name and password combination are not correct
echo "<h1>Username or Password incorrect</h1>";
}
}
?>
</body>
</html>
corlando
Forum Newbie
Posts: 21
Joined: Sun Jun 15, 2003 10:07 pm

Post by corlando »

reverse your braces
</tr></table>
</form>
<?
{
else
}
// connect to mysql
should be

Code: Select all

<?php
</tr></table> 
</form> 
<? 
}
else { 
// connect to mysql 

?>
Post Reply