我正在运行以下代码,但它给了我以下错误。我已经阅读了几篇关于SO的文章,仍然没有用。我得到的错误是:
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/xyz/public_html/13/beta/signup.php on line 49
Warning: Cannot modify header information - headers already sent by (output started at /home/xyz/public_html/13/beta/signup.php:49) in /home/xyz/public_html/13/beta/signup.php on line 69
我的PHP
脚本:(我已经标记了49
&行69
)
if(isset($_POST['submit'])&&$_POST['submit']=='Login')
{
$err = array();
if(!$_POST['username'] || !$_POST['pass'])
$err[] = 'All the fields must be filled in!';
if(!count($err))
{
$_POST['username'] = mysql_real_escape_string($_POST['username']);
$_POST['pass'] = mysql_real_escape_string($_POST['pass']);
$_POST['remember'] = (int)$_POST['remember'];
$row = mysql_fetch_assoc(mysql_query("SELECT id,user,email,clg FROM users WHERE user='{$_POST['username']}' AND pass='".md5($_POST['pass'])."'"));-->line 49
if($row['user'])
{
$_SESSION['user']=$row['user'];
$_SESSION['id'] = $row['id'];
$_SESSION['clg'] = $row['clg'];
$_SESSION['email'] = $row['email'];
$_SESSION['remember'] = $_POST['remember'];
setcookie('tcookie',$_POST['remember']);
header("Location: index.php");
exit;
}
else $err[]='Wrong username and/or password!';
}
if($err)
$_SESSION['msg']['login-err'] = implode('<br />',$err);
header("Location: signup.php");-->line 69
exit;
}