语法错误,意外';'

时间:2013-07-22 15:00:52

标签: php syntax syntax-error parse-error

我收到此错误:Parse error: syntax error, unexpected in /home/public_html/admin/login.php on line 15

<?PHP session_start();
$users = $_POST['txtuser'];
$passs = $_POST['txtpass'];
$passs= md5($passs);
include('../includes/myconnect.php');

$qry="SELECT * FROM users WHERE username='$users' and password='$passs'";
$res=mysql_query($qry);
$num=mysql_num_rows($res);
if($num>=1)
{
  $_SESSION['adminU']=$users;
  $_SESSION['adminP']=$passs;
  header("Location:emails.php");
}
else{header("Location:index.php?)msg=1";}
?>

如果我改变了这个:

  

否则{标题( “地点:的index.php)MSG = 1”;}

到此:

  

否则{标题( “地点:的index.php MSG = 1”);}

然后我收到此错误:

   Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
 /home/...../public_html/admin/login.php on line 9

    Warning: Cannot modify header information - headers already sent by (output
 started at /home/...../public_html/admin/login.php:9) in
 /home/...../public_html/admin/login.php on line 15

2 个答案:

答案 0 :(得分:3)

改变这个:

else{header("Location:index.php?)msg=1";}

到此:

else{header("Location:index.php?msg=1");}

答案 1 :(得分:0)

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
 /home/...../public_html/admin/login.php on line 9

此警告可能是因为您的查询返回空结果集。