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>
i am getting error Parse error: parse error, unexpected T_E
Moderator: General Moderators
reverse your braces
should be</tr></table>
</form>
<?
{
else
}
// connect to mysql
Code: Select all
<?php
</tr></table>
</form>
<?
}
else {
// connect to mysql
?>