次のコードを実行していますが、すべてで次のエラーが発生します。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;
}