db_connect 파일 :도움말 : 헤더 정보를 수정할 수 없습니다 - 이미 (출력에 의해 전송 헤더는 C에서 시작 : ## 오류
<?php
//connects to the database
$username = "username";
$password = "password";
$hostname = "host";
$database="database";
$link=mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL".mysql_error());
mysql_select_db($database, $link) or die("Could not select the database".mysql_error());
?>
과정-로그인 파일 :
<?php session_start();
include "DB_connect.php";
if(!isset($_SESSION))
$username=$_POST["UserName"];
$password=$_POST["Password"];
$errormessage = "";
$sql="SELECT * FROM members where UserName='$username' and Password='$password'";
$result = mysql_query($sql, $link) or exit('$sql failed: '.mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows==0){header("Location:login.php");}
else {
header("Location:MyPage.php");
exit;
}?>